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 isorg.postgresql.Driver, and the database connection URL prefix isjdbc:oGRAC.opengauss-jdbc-x.x.x.jar: The main class name isorg.opengauss.Driver, and the database connection URL prefix isjdbc:oGRAC.
Environment Classes
JDK 1.8 is required on the client. The configuration procedure is as follows:
Enter
java -versionin 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.Configure the system environment variables by following the steps below.
Right-click
This PCand selectProperties.On the
Systempage, click "Advanced System Settings" in the left navigation pane.On the
System Propertiespage, clickEnvironment Variableson theAdvancedtab page.On the
Environment Variablespage, clickNeworEditin theSystem variablesarea to configure system variables. For variable descriptions, see Table 1.Table 1 Variables
- If it exists, click Edit.
- If it does not exist, click New.