集成数据库:达梦

  1. 引入pom文件

打开biz业务模块的pom.xml文件`:

注释掉如下代码:

        <dependency>
            <groupId>org.anyline</groupId>
            <artifactId>anyline-data-jdbc-mysql</artifactId>
            <version>8.7.2-20241107</version>
        </dependency>

引入达梦的jar包:

             <dependency>
                <groupId>org.anyline</groupId>
                <artifactId>anyline-data-jdbc-dm</artifactId>
                <version>8.7.2-20241107</version>
            </dependency>
            <dependency>
                <groupId>com.dameng</groupId>
                <artifactId>DmJdbcDriver18</artifactId>
                <version>8.1.3.140</version>
            </dependency>
  1. 修改数据库连接:

打开application.yml文件: 按照实际环境修改配置:

    ##数据库地址  不要切换schema  就用默认的;指定schema在重庆的时候会报错
    url: jdbc:dm://127.0.0.1:30236?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
    driver-class-name: dm.jdbc.driver.DmDriver
    ##数据库账号
    username: SYSDBA
    ##数据库密码
    password: SYSDBA001
  1. 打开文件MessageConverterConfig,将达梦相关代码打开
 //TODO  如果是达梦数据库 请打开注释
             jacksonObjectMapperBuilder.serializerByType(DmdbNClob.class,DmdbNClobToStringSerializer.instance); 
   /**
     *TODO  如果是达梦数据库 请打开注释
     */
    public static class DmdbNClobToStringSerializer extends JsonSerializer<DmdbNClob> {

        public static final DmdbNClobToStringSerializer instance=new DmdbNClobToStringSerializer();
        /**
         * Method that can be called to ask implementation to serialize
         * values of type this serializer handles.
         *
         * @param value       Value to serialize; can <b>not</b> be null.
         * @param gen         Generator used to output resulting Json content
         * @param serializers Provider that can be used to get serializers for
         *                    serializing Objects value contains, if any.
         */
        @Override
        public void serialize(DmdbNClob value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
            if (value != null) {
                gen.writeString((value.data));
            }
        }
    }
  1. 导入数据库脚本: 项目中未单独创建dm的数据库脚本,可以先执行mysql的,然后通过达梦数据迁移工具导入到达梦库即可
  2. 执行如下sql,为了支持流程模型大json:
alter table flyflow_process enable using long row ;
alter table flyflow_process_instance_record enable using long row ;