Version: 7.0.0

JDBC Packages, Driver Classes, and Environment Classes ​

Java Database Connectivity (JDBC) is a Java API for executing SQL statements. It provides a unified access interface for various relational databases, allowing applications to operate data based on it. oGRAC supports JDBC 4.0 features and requires JDK 1.8 to compile program code. The JDBC‑ODBC bridge is not supported.

JDBC Packages ​

oGRAC provides two JDBC jar packages: postgresql.jar and openGauss-jdbc-x.x.x.jar. They have the same functionality and exist solely to resolve JDBC driver package name conflicts with PostgreSQL.

Execute build.sh in the Linux server-side source code directory to obtain the driver JAR packages postgresql.jar and opengauss-jdbc-x.x.x.jar. The packages are located in the output directory within the source code. They can also be obtained from the official release package, named oGRAC-x.x.x-JDBC.tar.gz.

  • postgresql.jar: The main class name is org.postgresql.Driver, and the database connection URL prefix is jdbc:oGRAC.

  • opengauss-jdbc-x.x.x.jar: The main class name is org.opengauss.Driver, and the database connection URL prefix is jdbc:oGRAC.

Environment Classes ​

JDK 1.8 is required on the client. The configuration procedure is as follows:

  1. Enter java -version in a DOS window to check whether the JDK version is JDK 1.8. If JDK is not installed, download the installation package from the official website and install it.

  2. Configure the system environment variables by following the steps below.

    1. Right-click This PC and select Properties.

    2. On the System page, click "Advanced System Settings" in the left navigation pane.

    3. On the System Properties page, click Environment Variables on the Advanced tab page.

    4. On the Environment Variables page, click New or Edit in the System variables area to configure system variables. For variable descriptions, see Table 1.

      Table 1 Variables

      Variable Name

      Operation

      Variable Value

      JAVA_HOME

      • If it exists, click Edit.
      • If it does not exist, click New.

      JAVA installation directory.

      Example: C:\Program Files\Java\jdk1.8.0_131

      Path

      Edit

      • If JAVA_HOME is configured, prepend the following to the variable value: %JAVA_HOME%\bin;
      • If JAVA_HOME is not configured, prepend the full JAVA installation path to the variable value:

        C:\Program Files\Java\jdk1.8.0_131\bin;

      CLASSPATH

      New

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