JDBC Package, Driver Class, and Environment Class

JDBC Package

Run build.sh in the source code directory on Linux OS to obtain the driver JAR package postgresql.jar, which is stored in the source code directory. Obtain the package from the release package named openGauss-x.x.x-OS version number-64bit-Jdbc.tar.gz.

The driver package is compatible with PostgreSQL. The class name and structure in the driver are the same as those in the PostgreSQL driver. All applications running on PostgreSQL can be smoothly migrated to the current system.

Driver Class

Before establishing a database connection, load the org.postgresql.Driver database driver class.

NOTE:
openGauss is compatible with PostgreSQL in the use of JDBC. Therefore, when two JDBC drivers are used in the same process, class names may conflict.

Environment Class

JDK 1.8 must be configured on the client. The configuration method is as follows:

  1. In the MS-DOS window, run java -version to check the JDK version. Ensure that the version is JDK 1.8. If JDK is not installed, download the installation package from the official website and install it.
  2. Configure system environment variables.
    1. Right-click My computer and choose Properties.

    2. In the navigation pane, choose Advanced system settings.

    3. In the System Properties dialog box, click Environment Variables on the Advanced tab page.

    4. In the System variables area of the Environment Variables dialog box, click New or Edit to configure system variables. For details, see Table 1.

      Table 1 Description

      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

      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

      New

      .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;

Feedback
编组 3备份
    openGauss 2024-05-30 00:44:48
    cancel