Obtaining the Driver JAR Package and Configuring the JDK Environment
Environment preparation includes obtaining the driver JAR package and configuring the JDK environment.
Obtaining the Driver JAR Package
Decompress the release package to obtain the corresponding driver JAR packages. The JDK 8 release package provides the driver packages that support the JDK 1.8 environments. The JDK 17 release package provides the driver package that supports the JDK 17 environment. The JDK 21 release package provides the driver package that supports the JDK 21 environment.
- GaussDB-Kernel_Database version number _Jdbc_X86_Jdk8_Distributed.tar.gz
- GaussDB-Kernel_Database version_OS version_64bit_Jdbc.tar.gz
- gaussdbjdbc.jar
- gscejdbc.jar
- gsjdbc4.jar
- gsjdbc200.jar
- opengaussjdbc.jar
- opengaussjdbc-ce.jar
- GaussDB-Kernel_Database version_OS version_64bit_Jdbc.tar.gz
The directory structure of the JDK 17 release package (x86 is used as an example) is as follows:
- GaussDB-Kernel_Database version_Jdbc_X86_Jdk17_Distributed.tar.gz
- GaussDB-Kernel_Database version_OS version_64bit_Jdbc.tar.gz
- gaussdbjdbc.jar
- gscejdbc.jar
- gsjdbc4.jar
- gsjdbc200.jar
- opengaussjdbc.jar
- opengaussjdbc-ce.jar
- GaussDB-Kernel_Database version_OS version_64bit_Jdbc.tar.gz
- GaussDB-Kernel_Database version_Jdbc_X86_Jdk21_Distributed.tar.gz
- GaussDB-Kernel_Database version_OS version_64bit_Jdbc.tar.gz
- gaussdbjdbc.jar
- gscejdbc.jar
- gsjdbc4.jar
- gsjdbc200.jar
- opengaussjdbc.jar
- opengaussjdbc-ce.jar
- GaussDB-Kernel_Database version_OS version_64bit_Jdbc.tar.gz
Obtain the corresponding JAR driver package from the release package as required.
- For the JDK 1.8 environment, use the JDK 8 release package.
- gaussdbjdbc.jar: The main class name is com.huawei.gaussdb.jdbc.Driver. The URL prefix of the database connection is jdbc:gaussdb. This package applies to the JDK 1.8 environment.
- 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 dependency libraries related to encryption and decryption that need to be loaded to the encrypted database. This driver package applies to encrypted scenarios. Currently, only EulerOS is supported.
- For the JDK 17 environment, use the JDK 17 release package.
- gaussdbjdbc.jar: The main class name is com.huawei.gaussdb.jdbc.Driver. The URL prefix of the database connection is jdbc:gaussdb. This package applies to the JDK 17 environment.
- 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 dependency libraries related to encryption and decryption that the encrypted database requires. It applies to encrypted scenarios. Currently, only EulerOS is supported.
- For the JDK 21 environment, use the JDK 21 release package.
- gaussdbjdbc.jar: The main class name is com.huawei.gaussdb.jdbc.Driver. The URL prefix of the database connection is jdbc:gaussdb. This package applies to the JDK 21 environment.
- 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 dependency libraries related to encryption and decryption that the encrypted database requires. It applies to encrypted scenarios. Currently, only EulerOS is supported.
- Before using the driver package gscejdbc.jar, you need to set the environment variable LD_LIBRARY_PATH. For details, see Using JDBC to Operate on an Encrypted Database.
- The JAR packages of the JDBC release package are classified by architecture. The gscejdbc.jar package can be used only when it is consistent with the deployment environment. Other JAR packages do not need to be consistent with the deployment environment.
- The drivers of the JDK 17 and JDK 21 release packages do not support the new features of JDBC 4.3.
Configuring the JDK Environment
The JDK environment must be configured on the client. This section uses JDK 1.8 as an example. JDK supports multiple platforms such as Windows and Linux. The following uses Windows as an example to describe the configuration method:
- Enter the following command in the MS-DOS window (command prompt in Windows) to check the JDK version:
java -version
Check whether JDK 1.8 has been installed. If not, download the installation package from the official website and install it.
- Configure system environment variables.
- Right-click My computer and choose Properties.
- In the System window, click Advanced system settings in the navigation pane.
The operation method may vary depending on the OS version.
- In the System Properties dialog box, click Environment Variables on the Advanced tab page.
- 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
What is your overall rating for this page?
Thank 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