Updated on 2024-10-21 GMT+08:00

Downloading the JDBC or ODBC Driver

The JDBC or ODBC driver is used to connect to data warehouse clusters. You can download the JDBC or ODBC driver provided by GaussDB(DWS) from the management console or use the open-source JDBC or ODBC driver.

Open-Source JDBC or ODBC Driver

GaussDB(DWS) also supports open-source JDBC and ODBC drivers: PostgreSQL JDBC 9.3-1103 or later; PostgreSQL ODBC 09.01.0200 or later

Downloading the JDBC or ODBC Driver

  1. Log in to the GaussDB(DWS) console.
  2. In the navigation tree on the left, choose Client Connections.
  3. In the Driver area, choose a driver that you want to download.

    Figure 1 Downloading the driver
    • JDBC Driver

      Method 1:

      Select DWS JDBC Driver and click Download to download the JDBC driver matching the current cluster version. The driver package name is dws_8.1.x_jdbc_driver.zip. After the package is decompressed, there will be two JAR packages gsjdbc4.jar and gsjdbc200.jar.

      • gsjdbc4.jar: The gsjdbc4.jar driver package is compatible with PostgreSQL. Its class names and class structures are the same as those of the PostgreSQL driver. Applications that run in PostgreSQL can be directly migrated to the current system.
      • gsjdbc200.jar: If a JVM process needs to access PostgreSQL and GaussDB(DWS) at the same time, this driver package must be used. In this package, the main class name is com.huawei.gauss200.jdbc.Driver (that is, org.postgresql is replaced with com.huawei.gauss200.jdbc). The URL prefix of the database connection is jdbc:gaussdb. Other parameters are the same as those of gsjdbc4.jar.

      If clusters of different versions are available, you will download the JDBC driver matching the earliest cluster version after clicking Download. If there is no cluster, you will download the JDBC driver of the earliest version after clicking Download. GaussDB(DWS) clusters are compatible with earlier versions of JDBC drivers.

      Click Historical Version to download the corresponding JDBC driver version. You are advised to download the JDBC driver based on the cluster version.

      The JDBC driver can be used on all platforms and depends on JDK 1.6 or later.

      If you have clusters of different versions, the system displays a dialog box, prompting you to select the cluster version and download the driver corresponding to the cluster version. In the cluster list on the Clusters > Dedicated Clusters page, click the name of the specified cluster to go to the Cluster Information page and view the cluster version.

      Table 1 JDBC driver download address

      Driver

      Download Link

      Verification File

      DWS JDBC Driver

      dws_8.2.x_jdbc_driver.zip

      dws_8.2.x_jdbc_driver.zip.sha256

      dws_8.1.x_jdbc_driver.zip

      dws_8.1.x_jdbc_driver.zip.sha256

      Method 2:

      Download the SDK software package by configuring the Maven repository. Click Add Maven Dependency. The following page is displayed.

      Figure 2 Maven page

      In the list shown in Figure 2, the first column indicates the cluster version, and the second column indicates the version number of the GaussDB(DWS) JDBC driver package. Select the driver package based on the cluster version and go to the following page:

      Figure 3 Maven dependency

      Copy the Maven repository information and add it to the pom.xml file. For example, add the following code configuration to the pom.xml file:

      • gsjdbc4.jar
        1
        2
        3
        4
        5
        <dependency>
            <groupId>com.huaweicloud.dws</groupId>
            <artifactId>huaweicloud-dws-jdbc</artifactId>
            <version>8.1.0</version> 
        </dependency>
        
      • gsjdbc200.jar
        <dependency>
            <groupId>com.huaweicloud.dws</groupId>
            <artifactId>huaweicloud-dws-jdbc</artifactId>
            <version>8.1.1.1-200</version>
        </dependency>  
    • ODBC Driver

      Select a corresponding version and click Download to download the ODBC driver matching the current cluster version. If clusters of different versions are available, you will download the ODBC driver matching the earliest cluster version after clicking Download. If there is no cluster, you will download the ODBC driver of the earliest version after clicking Download. GaussDB(DWS) clusters are compatible with earlier versions of ODBC drivers.

      Click Historical Version to download the corresponding ODBC driver version. You are advised to download the ODBC driver based on the cluster version.

      The ODBC driver is incompatible with Windows Server 2016.