pom.xml文件里添加
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>Dm8JdbcDriver18</artifactId>
<version>8.1.1.49</version>
</dependency>
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmDialect-for-hibernate5.3</artifactId>
<version>8.1.1.49</version>
</dependency>
<dependency>
<!--注意:只有这个版本的hibernate兼容达梦数据库 -->
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.18.Final</version>
</dependency>
yaml文件里配置:
spring:
jpa:
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.DmDialect
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driver-class-name: dm.jdbc.driver.DmDriver
url: jdbc:dm://localhost:5237?schema=smartsitetest2
username: TEST
password: 123456789
initial-size: 10
max-active: 100
min-idle: 10
max-wait: 60000
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 20
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
stat-view-servlet:
enabled: true
url-pattern: /druid/*
#login-username: admin
#login-password: admin
filter:
stat:
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: false
wall:
config:
multi-statement-allow: true
mybatis-plus:
global-config:
banner: false
#日志级别
logging:
level:
root: INFO
org.springframework.security:
- debug
- info
org.springframework.web: error
org.hibernate.SQL: debug
org.hibernate.engine.QueryParameters: debug
org.hibernate.engine.query.HQLQueryPlan: debug
org.hibernate.type.descriptor.sql.BasicBinder: trace
file:
path: logs
SQL语句符合DM的语法就行,本人亲测通过,记录一下,帮助别人。