Help Center/ MapReduce Service/ Developer Guide (LTS)/ Doris Development Guide (Security Mode)/ Doris Environment Preparation/ Configuring and Importing JDBC, Stream Load or Flink Jar Sample Projects
Updated on 2026-06-29 GMT+08:00
Configuring and Importing JDBC, Stream Load or Flink Jar Sample Projects
Background
To run the JDBC API sample code of the Doris component, perform the following operations.
Procedure
- Obtain the sample project folder doris-jdbc-example, doris-stream-load-example (MRS 3.3.1-LTS and later versions) or doris-flink-jar-example (MRS 3.6.0-LTS and later versions) in the src\doris-examples directory in the sample code decompression directory by referring to Obtaining the MRS Application Development Sample Project.
- Import the sample project to the IntelliJ IDEA development environment.
- On the menu bar of IntelliJ IDEA, choose File > Open... to display the Open File or Project dialog box.
- In the displayed dialog box, select the doris-jdbc-example folder and click OK. In Windows, the full path of the folder does not contain spaces.
- This section describes how to develop an application that connects to the Doris service in JDBC mode in Windows.
- Versions prior to MRS 3.5.0-LTS:
- Set the DORIS_MY_USER and DORIS_MY_PASSWORD environment variables in the local environment variables. Store the environment variables in ciphertext and decrypt the environment variables to ensure security.
- DORIS_MY_USER indicates the user name for logging in to the Doris.
- DORIS_MY_PASSWORD indicates the password for logging in to the Doris.
- After the jdbc-example sample project is imported, modify the following parameters:
- In the code, change xxx in HOST = "xxx" to the IP address of the master FE node of the Doris. To obtain the IP address of the master FE node, choose Cluster > Services > Doris on Manager and view the Host Where Leader Locates.
- In the code, change xxx where PORT = "xxx" to the MySQL query connection port of Doris. The default port is 29982. To obtain the port, log in to FusionInsight Manager, choose Cluster > Services > Doris > Configurations, and search for query_port.
- Set the DORIS_MY_USER and DORIS_MY_PASSWORD environment variables in the local environment variables. Store the environment variables in ciphertext and decrypt the environment variables to ensure security.
- MRS 3.5.0-LTS and later versions, after the sample project is imported, modify the parameters in the src/main/resources/conf.properties file in the corresponding sample folder for subsequent running of the sample project.
- doris-jdbc-example
HOST=127.0.0.1 QUERY_PORT=29982 JDBC_DRIVER=com.mysql.cj.jdbc.Driver USER= PASSWD=
- doris-stream-load-example
HOST=127.0.0.1 QUERY_PORT=29982 JDBC_DRIVER=com.mysql.cj.jdbc.Driver USER= PASSWD= PORT=29991
- doris-flink-jar-example (MRS 3.6.0-LTS and later versions)
FE_NODES=127.0.0.1:29991,127.0.0.2:29991,127.0.0.3:29991 USER= PASSWD=
- You can log in to FusionInsight Manager, choose Cluster > Services > Doris, and obtain the values of the following parameters.
- HOST indicates the IP address of the master FE node of Doris. You can obtain the value from the Host Where Leader Locates on the Dashboard sheet of the Doris service.
- Query_PORT indicates the MySQL protocol query connection port of Doris. To obtain the port, click Configurations and search for query_port.
- Port: port number for accessing the FE. To obtain the port number, click Configurations and search for https_port.
- USER and PASSWD are the username and password obtained in section Preparing a Developer Account.
- FE_NODES consists of FE IP addresses and HTTPS ports, formatted as FE IP address: HTTPS port number, with multiple addresses separated by commas.
- doris-jdbc-example
- Set the encoding format of the IntelliJ IDEA text file to solve the problem of garbled characters.
- Choose File > Settings... from the main menu of IntelliJ IDEA.
The Settings window is displayed.
- In the navigation tree on the left, choose Editor > File Encodings. In the Project Encoding and Global Encoding areas, set the parameter value to UTF-8, click Apply, and click OK, as shown in Figure 1.
- Choose File > Settings... from the main menu of IntelliJ IDEA.
- Set the JDK of the project.
- On the IntelliJ IDEA menu bar, choose File > Settings.... The Settings window is displayed.
- Versions prior to MRS 3.6.0-LTS, choose Build, Execution, Deployment > Compiler > Java Compiler, select 8 from the Project bytecode version drop-down list box. Change the value of Target bytecode version to 8 for doris-jdbc-example.

- MRS 3.6.0-LTS and later versions, choose Build, Execution, Deployment > Compiler > Java Compiler and confirm the JDK version used for running the sample code.
- If JDK 8 is used, select 8 from the Project bytecode version drop-down list box. Change the value of Target bytecode version for doris-jdbc-example to 8.
- If JDK 17 is used, select 17 from the Project bytecode version drop-down list box. Change the value of Target bytecode version for doris-jdbc-example to 17.
- If JDK 21 is used, select 21 from the Project bytecode version drop-down list box. Change the value of Target bytecode version for doris-jdbc-example to 21.

- Versions prior to MRS 3.6.0-LTS, choose Build, Execution, Deployment > Compiler > Java Compiler, select 8 from the Project bytecode version drop-down list box. Change the value of Target bytecode version to 8 for doris-jdbc-example.
- Click Apply and OK.
- On the IntelliJ IDEA menu bar, choose File > Project Structure.... The Project Structure window is displayed.
- Select SDKs, click the plus sign (+), and select JDK.

- On the Select Home Directory for JDK page that is displayed, select the JDK directory and click OK.
- After selecting the JDK, click Apply.
- Select Project, select the JDK added in SDKs from the Project SDK drop-down list box, and select 8 - Lambdas, type annotations etc. from the Project language level drop-down list box. MRS 3.6.0-LTS and later versions, if the selected JDK version is 17, select 17 - Sealed types, always-strict floating-point semantics. If the selected JDK version is 21, select 21 - Record patterns, pattern matching for switch..

- Click Apply.
- Choose Modules. On the Source page, change the value of Language level to 8 - Lambdas, type annotations etc. MRS 3.6.0-LTS and later versions, if the selected JDK version is 17, set Language level to 17 - Sealed types, always-strict floating-point semantics. If the selected JDK version is 21, set Language level to 21 - Record patterns, pattern matching for switch..

On the Dependencies page, change the value of Module SDK to the JDK added in SDKs.

- Click Apply and OK.
- On the IntelliJ IDEA menu bar, choose File > Settings.... The Settings window is displayed.
- Configure Maven.
- Add the configuration information such as the address of the open-source image repository to the setting.xml configuration file of the local Maven by referring to Obtaining the MRS Application Development Sample Project.
- On the IntelliJ IDEA page, select File > Settings > Build, Execution, Deployment > Build Tools > Maven, select Override next to User settings file, and change the value of User settings file to the directory where the settings.xml file is stored. Ensure that the directory is <Local Maven installation directory>\conf\settings.xml. Figure 2 Directory for storing the settings.xml file
- Click the drop-down list next to Maven home directory and select the Maven installation directory.
- Click Apply, and then click OK.
Parent topic: Doris Environment Preparation
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot
