Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

JDBC Package, Driver Class, and Environment Class

Updated on 2024-05-07 GMT+08:00

JDBC 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.
  • gscejdbc.jar: The main class name is com.huawei.gaussdb.jdbc.Driver. The URL prefix of database connections is jdbc:gaussdb. This driver package contains the dependent libraries related to encryption and decryption that need to be loaded to the encrypted database. This driver package is recommended in encrypted scenarios. Currently, only EulerOS is supported. Before using the gscejdbc.jar driver package, set the environment variable LD_LIBRARY_PATH. For details, see "Setting Encrypted Equality Queries > Using JDBC to Operate an Encrypted Database" in Feature Guide.
  • opengaussjdbc.jar: The main class name is com.huawei.opengauss.jdbc.Driver. The URL prefix of the database connection is jdbc:opengauss. This driver package is recommended. This driver package is used when both PostgreSQL and GaussDB are accessed in a JVM process.
NOTICE:
  • The loading paths and URL prefixes of driver classes vary in different driver packages, but the API functions are the same.
  • gsjdbc200.jar: The main class name is com.huawei.gauss200.jdbc.Driver, and the URL prefix of the database connection is jdbc:gaussdb. 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 APIs are different. The APIs that are not supported need to be adjusted on the service side.
  • 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 GaussDB. 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.

Driver Class

Before establishing a database connection, load the org.postgresql.Driver database driver class (corresponding to the gsjdbc4.jar file).

NOTE:
  1. GaussDB is compatible with PostgreSQL in the use of JDBC. Therefore, when two JDBC drivers are used in the same process, class names may conflict.
  2. JDBC of this version does not support identity & access management suite (IAM) for authentication.
  3. Compared with the PostgreSQL driver, the GaussDB JDBC driver has the following enhanced features:
    1. The SHA256 encryption mode is supported for login.
    2. The third-party log framework that implements the sf4j API can be connected.
    3. Distributed load balancing at the connection level is supported.
    4. DR failover is supported.

Environment Class

The JDK1.8 must be configured on the client. JDK supports multiple platforms such as Windows and Linux. The following uses Windows as an example to describe how to configure JDK:

  1. Enter java -version in the MS-DOS window (command prompt in Windows) to check the JDK version. Ensure that the JDK version is JDK1.8. If the JDK is not installed, download the installation package and install it.
  2. On the Windows desktop, right-click This PC and choose Properties from the shortcut menu.
  3. In the System window, click Advanced system settings in the navigation tree on the left.
  4. In the System Properties dialog box, click Environment Variables in the lower right corner.
  5. In the System variables area of the Environment Variables dialog box, set the following variables.

    Table 1 Variables

    Variable

    Operation

    Variable Value

    JAVA_HOME

    • If the variable exists, click Edit.
    • If the variable does not exist, click New.

    Specifies the Java installation directory.

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

    Path

    Click Edit.

    • If JAVA_HOME is configured, add %JAVA_HOME%\bin before the variable value.
    • If JAVA_HOME is not configured, add the full Java installation path before the variable value:

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

    CLASSPATH

    Click New.

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

  6. Click OK and close the windows one by one.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback