HomeMogDBMogDB StackUqbar
v2.1

Documentation:v2.1

Supported Versions:

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-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.

img NOTE:

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

  • Compared with the PostgreSQL driver, the openGauss 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. - DR failover is supported.

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. If the system environment JDK version is lower than 1.8, please refer to Use WebSphere to Configure MogDB Data Sources.

  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_H
Copyright © 2011-2024 www.enmotech.com All rights reserved.