• 首页
  • 产品中心
    • 数式Oinone四大产品

      低代码开发平台无代码开发平台集成开发平台AI大模型开发
    • 数式Oinone体系能力

      用户与组织权限管理文件管理消息中心国际化业务审计
    • 数式Oinone核心产品特性

      低无一体面向软件公司场景无限制应用级扩容可分可合
  • 服务中心
    • 客户服务

      预约演示方案咨询私有部署找人定制
    • 开发者

      问答下载
    • Oinone学院

      社区学习

    《精讲面向软件公司的低代码平台——以Oinone为例》

  • 合作伙伴
    渠道申请伙伴名录专家库
  • 关于数式
0571-88757863

Data Dialect:【OpenGauss】Using OpenGauss Database for Backend Deployment


Ⅰ、Driver Configuration

(Ⅰ)Maven Configuration

Download the driver package from Huawei official website: gsjdbc4.jar;

<dependency>
  <groupId>org.postgresql</groupId>
  <artifactId>gsjdbc</artifactId>
  <version>4</version>
  <scope>system</scope>
  <!-- Both of the following methods are acceptable-->
  <systemPath>${pom.basedir}/libs/gsjdbc4.jar</systemPath>
  <!--<systemPath>/Users/wangxian/java-tools/guassdb/gsjdbc4.jar</systemPath>-->
</dependency>

(Ⅱ)JDBC Connection Configuration

pamirs:
  datasource:
    pamirs:
      type: com.alibaba.druid.pool.DruidDataSource
      driverClassName: org.postgresql.Driver
      url: jdbc:postgresql://127.0.0.1:5432/pamirs?currentSchema=demo
      username: XXXXXX
      password: XXXXXX
      initialSize: 5
      maxActive: 200
      minIdle: 5
      maxWait: 60000
      timeBetweenEvictionRunsMillis: 60000
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      asyncInit: true
    base:
      type: com.alibaba.druid.pool.DruidDataSource
      driverClassName: org.postgresql.Driver
      url: jdbc:postgresql://127.0.0.1:5432/pamirs?currentSchema=demo_base
      username: XXXXXX
      password: XXXXXX
      initialSize: 5
      maxActive: 200
      minIdle: 5
      maxWait: 60000
      timeBetweenEvictionRunsMillis: 60000
      testWhileIdle: true
      testOnBorrow: false
      testOnReturn: false
      poolPreparedStatements: true
      asyncInit: true

(Ⅲ)Connection URL Configuration

Click to view official documentation: Official Documentation

1、URL Format

jdbc:postgresql://${host}:${port}/${database}?currentSchema=${schema}

Warning:

When configuring the Pamirs connection, ${database} and ${schema} must be fully configured and cannot be omitted.

For other connection parameters, you can refer to relevant materials for optimization as needed.

(Ⅳ)Dialect Configuration

1、Pamirs Dialect Configuration

pamirs:
  dialect:
    ds:
      base:
        type: GaussDB
        version: 5
        majorVersion: 5.0.1
      pamirs:
        type: GaussDB
        version: 5
        majorVersion: 5.0.1
Database VersiontypeversionmajorVersion
5.xGaussDB55.0.1

Note:

Since the dialect development environment uses version 5.0.1, other similar versions (5.x) should not have significant differences. If you encounter unsupported versions, please leave a comment below the document.

2、Schedule Dialect Configuration

pamirs:
  event:
    enabled: true
    schedule:
      enabled: true
      dialect:
        type: GaussDB
        version: 5
        major-version: 5.0.1

Note: For more YAML configurations, please refer to Module API.

typeversionmajorVersion
GaussDB55.0.1

Note:

Since there are no obvious differences in the schedule dialect across multiple versions, only one dialect configuration is provided currently.

(Ⅴ)Other Configurations

1、Logical Delete Value Configuration

pamirs:
  mapper:
    global:
      table-info:
        logic-delete-value: (EXTRACT(epoch FROM CURRENT_TIMESTAMP) * 1000000 + EXTRACT(MICROSECONDS FROM CURRENT_TIMESTAMP))::bigint

Ⅱ、Gauss Database User Initialization and Authorization

-- init root user (user name can be modified by oneself)
-- Create user wangxian
CREATE USER wangxian PASSWORD 'wx@123456';
-- If using automatic database and schema creation, this is very important.
-- Grant system permission CREATEDB to user wangxian
ALTER USER wangxian CREATEDB;

SELECT * FROM pg_roles;
-- If using Gauss database, this authorization is required.
GRANT CREATE ON DATABASE pamirs TO root;

Ⅲ、Considerations for Migrating Data from MySQL to Gauss Database

Since the configuration of MySQL auto-increment IDs is in the table creation statement, while Gauss uses a separate sequence table to record auto-increment IDs, the auto-increment ID data needs to be migrated independently after data synchronization.

(Ⅰ)Models Using Auto-increment IDs in Built-in Platform Modules:

  • LeafAlloc in base module
  • WorkerNode in base module
  • PamirsSchedule in trigger module
  • EipLog in eip module
  • ModelMetaChangeRecord in designerCommon module

Demonstration of migration SQL, please modify the database name according to the actual situation. Skip executing corresponding SQL for modules without dependencies. For migrating business models, refer to the following SQL:

SELECT setval('demo_base.leaf_alloc_id_seq', (select id from demo_base.leaf_alloc order by id desc limit 1), true);

SELECT setval('demo_base.base_worker_node_id_seq', (select id from demo_base.base_worker_node order by id desc limit 1), true);

SELECT setval('demo_pamirs.pamirs_schedule_0_id_seq', (select id from demo_pamirs.pamirs_schedule_0 order by id desc limit 1), true);

SELECT setval('demo_pamirs.eip_eip_log_id_seq', (select id from demo_pamirs.eip_eip_log order by id desc limit 1), true);

SELECT setval('demo_pamirs.common_model_meta_change_record_id_seq', (select id from demo_pamirs.common_model_meta_change_record order by id desc limit 1), true);

Ⅳ、How to Manually Set Auto-increment Sequence Values in Gauss

(Ⅰ)Using the setval Function

The setval function directly sets the current value of a sequence, suitable for scenarios requiring precise control over sequence values.

  • The first parameter of setval is the sequence name.
  • The second parameter is the value to set (e.g., 10).
  • The third parameter indicates whether to set the is_called flag to true, meaning the next nextval call returns the set value.

(Ⅱ)Example Operations

Assume your full sequence name is demo_pamirs.pamirs_schedule_0_id_seq, where demo_pamirs is the database name. The specific steps are as follows:

  1. Reset the current value of the sequence:
# Set the sequence to 10
SELECT setval('demo_pamirs.pamirs_schedule_0_id_seq', 10, true);
  1. Verify the new sequence value:
# The last_value field shows 10
SELECT * FROM demo_pamirs.pamirs_schedule_0_id_seq;
Edit this page
Last Updated:1/15/26, 4:02 AM
Prev
Data Dialect:[MSSQL] Backend Deployment with MSSQL Database (SQL Server)
Next
Data Dialect:[PostgreSQL] Backend Deployment with PostgreSQL Database
默认页脚
Copyright © 2026 Mr.Hope