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 GaussDB 200. The driver class and loading path are the same as those before the migration, but the supported interfaces are different. The interfaces 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 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 interface 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 interface 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.
  • After the environment variable GOENV_REGIST_ALL is set to false, the Go driver can coexist with that of PostgreSQL. If this parameter is not set or set to true, and the Go driver code depends on the Go driver of PostgreSQL, an error is reported.

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]