JDBC Packages, Driver Classes, and Environment Classes
JDBC Packages
Obtain the GaussDB-Kernel_Database version number_OS version number_64bit_Jdbc.tar.gz package from the release package. After the decompression, you will obtain the following JDBC packages in .jar format:
- gaussdbjdbc.jar: The main class name is com.huawei.gaussdb.jdbc.Driver. The URL prefix of the database connection is jdbc:gaussdb. This driver package is recommended. The Java code examples in this section use the gaussdbjdbc.jar package by default.
- gscejdbc.jar: The main class name is com.huawei.gaussdb.jdbc.Driver. The URL prefix of the database connection is jdbc:gaussdb. This driver package contains the dependent libraries related to encryption and decryption that need to be loaded to the encrypted database. You are advised to use this driver package in encrypted scenarios. Currently, only EulerOS is supported.
- gaussdbjdbc-JRE7.jar: The main class name is com.huawei.gaussdb.jdbc.Driver. The URL prefix of the database connection is jdbc:gaussdb. The gaussdbjdbc-JRE7.jar package is used in the JDK 1.7 environment.
- Before using the gscejdbc.jar driver package, you need to set the environment variable LD_LIBRARY_PATH. For details, see section "Setting Encrypted Equality Queries > Using JDBC to Operate an Encrypted Database" in Feature Guide.
- In JDK 1.8, you are advised to use gaussdbjdbc.jar instead of gaussdbjdbc-JRE7.jar.
- The JAR packages of the JDBC release package are classified by architecture. Except gscejdbc.jar, the deployment environment of the JAR packages can be different from that of the JAR packages.
- For details about other JAR packages, see JDBC Compatibility Package.
Driver Class
Before establishing a database connection, load the com.huawei.gaussdb.jdbc.Driver database driver class.
- GaussDB is compatible with PostgreSQL in the use of JDBC. Therefore, when two JDBC drivers are used in the same process, class names may conflict.
- JDBC of this version does not support identity & access management suite (IAM) for authentication.
- The GaussDB JDBC driver has the following enhanced features:
- The SHA256 encryption mode is supported for login.
- The third-party log framework that implements the sf4j API can be connected.
- Distributed load balancing at the connection level is supported.
- DR failover is supported.
Environment Class
The JDK1.8 must be configured on the client. JDK supports multiple platforms such as Windows and Linux. The following uses Windows as an example to describe how to configure JDK:
- Enter java -version in the MS-DOS window (command prompt in Windows) to check the JDK version. Ensure that the JDK version is JDK1.8. If the JDK is not installed, download the installation package and install it.
- On the Windows desktop, right-click This PC and choose Properties from the shortcut menu.
- In the System window, click Advanced system settings in the navigation pane.
- In the System Properties dialog box, click Environment Variables in the lower right corner.
- In the System variables area of the Environment Variables dialog box, click New or Edit to configure system variables. For details about the variables, see Table 1.
Table 1 Variables Variable
Operation
Variable Value
JAVA_HOME
- If the variable exists, click Edit.
- If the variable does not exist, click New.
Specifies the Java installation directory.
Example: C:\Program Files\Java\jdk1.8.0_131
Path
Click Edit.
- If JAVA_HOME is configured, add %JAVA_HOME%\bin before the variable value.
- If JAVA_HOME is not configured, add the full Java installation path before the variable value:
C:\Program Files\Java\jdk1.8.0_131\bin
CLASSPATH
Click New.
%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
- Click OK and close the windows one by one.
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.
For any further questions, feel free to contact us through the chatbot.
Chatbot