Updated on 2024-06-03 GMT+08:00

Compatibility Reference

JDBC Compatibility Package

Obtain the package from the release package GaussDB-Kernel_Database version number_OS version number_64bit_Jdbc.tar.gz.

After the decompression, you will obtain the following JDBC packages in .jar format:

  • gsjdbc4.jar: The main class name is org.postgresql.Driver, and the URL prefix of the database connection is jdbc:postgresql. This driver package applies to the scenario where services are migrated from PostgreSQL. The driver class and loading path are the same as those before the migration, but the supported APIs are different. The APIs that are not supported need to be adjusted on the service side.
  • gsjdbc200.jar: This driver package applies to the scenario where services are migrated from Gauss200. The driver class and loading path are the same as those before the migration, but the supported APIs are different. The APIs that are not supported need to be adjusted on the service side.
  • opengaussjdbc.jar: The main class name is com.huawei.opengauss.jdbc.Driver, and the URL prefix of the database connection is jdbc:opengauss. This driver package is used when both PostgreSQL and GaussDB are accessed in a JVM process.
  • The loading paths and URL prefixes of driver classes vary in different driver packages, but the API functions are the same.
  • The gsjdbc4 driver package cannot be used to operate the PostgreSQL database. Although the connection can be successfully established in some versions, some API behaviors are different from those of PostgreSQL JDBC, which may cause unknown errors.
  • The PostgreSQL driver package cannot be used to operate the GaussDB database. Although the connection can be successfully established in some versions, some API behaviors are different from those of GaussDB JDBC, which may cause unknown errors.

Go Driver Compatibility

  • The Go driver provided by the database does not adapt to mature ORM frameworks (such as XORM) in the industry. As such, the driver name input during database connection creation must be compatible with Postgres and PostgreSQL.
  • The Go driver of the database cannot coexist with that of PostgreSQL.

ecpg Compatibility

ecpg provides the URL connection syntax which supports GaussDB and is compatible with PostgreSQL.

Connection syntax:

EXEC SQL CONNECT TO target [AS connection-name] [USER user-name];
To support PostgreSQL, target is set as follows:
  • tcp:postgresql://hostname[:port][/dbname][?options]
  • unix:postgresql://hostname[:port][/dbname][?options]