JeecgBoot连接达梦数据库
最后更新于:2022-04-02 07:12:15
[TOC]
## 方式一:可兼容jeecg-cloud,缺点暂不支持流程
pom文件
```
com.dameng
DmJdbcDriver18
1.0
com.dameng
DmDialectForHibernate
5.3
```
application-dev.yml文件
将dataSource删除掉并新增下面语句
```
# autoconfigure:
# exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
driverClassName: dm.jdbc.driver.DmDriver
url: jdbc:dm://192.168.1.199:5236/?JEECG&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
username: JEECG
password: 12345679A@
```
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/69/3d/693d3b693ad647697ed84ca40ade0f1a_934x761.png)
注释掉下面的语句
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/39/a0/39a0534c5e2bb6cd1b93baf34a248700_1087x74.png)
jpa新增语句
```
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.Oracle8iDialect
```
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/59/bf/59bf877e9d410bb2356215ac38cf1cf0_793x151.png)
## 方式二:第一种方式jeecg-boot 后台配置
1. 后台system中的pom文件新增jar包引入
```
com.dameng
DmJdbcDriver18
1.0
com.mchange
c3p0
0.9.5.2
```
3. application.yml
```
将
spring:
dataSource:
下配置内容注释掉
```
4.resources下新增jdbc.properties
```
jdbc.url=jdbc:dm://localhost:5236/SYSDBA&useSSL=false&serverTimezone=UTC&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true
jdbc.username=SYSDBA
jdbc.password=SYSDBA
jdbc.driverClass=dm.jdbc.driver.DmDriver
cpool.checkoutTimeout=50000
cpool.minPoolSize=1
cpool.maxPoolSize=3
cpool.maxIdleTime=7200
cpool.maxIdleTimeExcessConnections=1800
cpool.acquireIncrement=2
```
5.resources下新增applicationContext.xml
```
hibernate.dialect=org.hibernate.dialect.Oracle8iDialect
```
6.启动器(jeecgApplication)配置引入applicationContext.xml
```
@ImportResource("classpath:applicationContext.xml")
```
## 达梦数据库可视化工具和数据库迁移工具
按win键找到达梦数据库,打开后可看见
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/c1/4d/c14d74539066cace0a863097e8aca875_274x469.png)
DM管理工具为可视化工具
数据库迁移可将mysql、orcale等数据库转换成达梦数据库
注意:当数据迁移时,
![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/81/aa/81aac57d7251fee9d6103b8742b30ee7_273x270.png)
用户名称需和模式名称一致,否则sql语句需要模式名.表名才能访问数据库,不然会报错
## 达梦数据库官网下载地址
```
项目采用DMB8开发版(windows64位)
```
[http://www.dameng.com/down.aspx?TypeId=11&FId=t14:11:14](http://www.dameng.com/down.aspx?TypeId=11&FId=t14:11:14)
';