[TOC] ## 方式一:可兼容jeecg-cloud,缺点暂不支持流程 pom文件 ``` <dependency> <groupId>com.dameng</groupId> <artifactId>DmJdbcDriver18</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>com.dameng</groupId> <artifactId>DmDialectForHibernate</artifactId> <version>5.3</version> </dependency> ``` 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://img.kancloud.cn/69/3d/693d3b693ad647697ed84ca40ade0f1a_934x761.png) 注释掉下面的语句 ![](https://img.kancloud.cn/39/a0/39a0534c5e2bb6cd1b93baf34a248700_1087x74.png) jpa新增语句 ``` jpa: properties: hibernate: dialect: org.hibernate.dialect.Oracle8iDialect ``` ![](https://img.kancloud.cn/59/bf/59bf877e9d410bb2356215ac38cf1cf0_793x151.png) ## 方式二:第一种方式jeecg-boot 后台配置 1. 后台system中的pom文件新增jar包引入 ``` <!-- 达梦驱动包--> <dependency> <groupId>com.dameng</groupId> <artifactId>DmJdbcDriver18</artifactId> <version>1.0</version> </dependency> <!-- c3p0数据库连接池--> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency> ``` 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 ``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 自动扫描--> <context:component-scan base-package="org.jeecg"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/> <context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> <!-- 加载jdbc文件--> <context:property-placeholder location="classpath:jdbc.properties" ignore-unresolvable="true"/> <!-- 配置数据库 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${jdbc.driverClass}"/> <property name="jdbcUrl" value="${jdbc.url}" /> <property name="user" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="checkoutTimeout" value="${cpool.checkoutTimeout}" /> <property name="minPoolSize" value="${cpool.minPoolSize}" /> <property name="maxPoolSize" value="${cpool.maxPoolSize}"/> <property name="maxIdleTime" value="${cpool.maxIdleTime}"/> <property name="maxIdleTimeExcessConnections" value="${cpool.maxIdleTimeExcessConnections}" /> <property name="acquireIncrement" value="${cpool.acquireIncrement}" /> </bean> <!-- 配置语言包,因达activiti不支持达梦数据库,因达梦数据库仿照Oracle数据库,故用oracle语言包--> <bean id="sessionFactory2" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="hibernateProperties"> <value> hibernate.dialect=org.hibernate.dialect.Oracle8iDialect </value> </property> </bean> <!-- 事务配置--> <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> <property name="dataSource" ref="dataSource"/> <property name="sessionFactory" ref="sessionFactory2"/> </bean> <!-- activiti配置--> <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"> <property name="dataSource" ref="dataSource" /> <property name="jobExecutorActivate" value="false" /> <!-- 如果数据库没有表时请将false改成true --> <property name="databaseSchemaUpdate" value="false"/> <property name="transactionManager" ref="transactionManager"/> <!-- 将类型设置为oracle--> <property name="databaseType" value="oracle"/> <property name="dbIdentityUsed" value="false" /> <property name="history" value="full" /> </bean> </beans> ``` 6.启动器(jeecgApplication)配置引入applicationContext.xml ``` @ImportResource("classpath:applicationContext.xml") ``` ## 达梦数据库可视化工具和数据库迁移工具 按win键找到达梦数据库,打开后可看见 ![](https://img.kancloud.cn/c1/4d/c14d74539066cace0a863097e8aca875_274x469.png) DM管理工具为可视化工具 数据库迁移可将mysql、orcale等数据库转换成达梦数据库 注意:当数据迁移时, ![](https://img.kancloud.cn/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)