1.pom文件加入依赖
<dependency>
<!--注意:只有这个版本的hibernate兼容达梦数据库 -->
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.18.Final</version>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.1.193</version>
</dependency>
<dependency>
<groupId>DM</groupId>
<artifactId>DmDialect-for-hibernate</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/lib/DmDialect-for-hibernate5.3.jar</systemPath>
</dependency>
2.application.yml文件配置
#配置 Jpa
jpa:
hibernate:
ddl-auto: update
naming:
implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl
properties:
hibernate:
# dialect: org.hibernate.dialect.MySQL5InnoDBDialect
dialect: org.hibernate.dialect.DmDialect
open-in-view: true
show-sql: true
datasource:
druid:
test-while-idle: true
test-on-borrow: true
validation-query: SELECT 1
#配置数据源
spring:
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://127.0.0.1:5236/SYSDBA?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
username: SYSDBA
password: SYSDBA
3.数据库数据MySQL–>DM
下载安装DM8
https://eco.dameng.com/download/
数据库数据由MySQL迁移至达梦
https://eco.dameng.com/document/dm/zh-cn/start/migrate-mysql-dm.html