注册
Springboot+jpa+达梦数据库配置
培训园地/ 文章详情 /

Springboot+jpa+达梦数据库配置

nxcrazy 2023/08/10 3740 0 0

一、数据库安装部署
官网下载地址:https://eco.dameng.com/download
1.安装步骤:略
2.达梦数据库驱动jar包 DmJdbcDriver18.jar
3.达梦数据库对hibernate的方言包 DmDialect-for-hibernate5.3.jar
备注:如果启动项目后,进程卡住,maven中没有对应的jar包,需要在项目中新建lib文件,将jar包放入,再在pom中引本地的这个两个依赖。
二、Pom文件配置
此处内容需要根据实际的情况进行配置,包括驱动包的版本以及所在的路径。
图片.png
三、Springboot配置
spring.datasource.driverClassName=dm.jdbc.driver.DmDriver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:dm://localhost:15236
spring.datasource.username=SYSDBA
spring.datasource.password=SYSDBA
spring.datasource.initialSize=10
spring.datasource.minIdle=10
spring.datasource.maxActive=100
spring.datasource.maxWait=60000
spring.datasource.timeBetweenEvictionRunsMillis=60000
spring.datasource.minEvictableIdleTimeMillis=300000
spring.datasource.validationQuery=SELECT 'x'
spring.datasource.testWhileIdle=true
spring.datasource.testOnBorrow=false
spring.datasource.testOnReturn=false
spring.datasource.poolPreparedStatements=false
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
spring.datasource.filters=stat
spring.datasource.logSlowSql=true

注:此配置信息也需要根据实际情况进行修改。
四、JPA配置
spring.jpa.database-platform=org.hibernate.dialect.DmDialect
spring.jpa.properties.hibernate.show_sql=true
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.default_schema=SYSDBA
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
spring.jpa.properties.hibernate.query.substitutions=true 1, false 0
spring.jpa.properties.hibernate.default_batch_fetch_size=20
spring.jpa.properties.hibernate.max_fetch_depth=2
spring.jpa.properties.hibernate.generate_statistics=true
spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=true
spring.jpa.properties.hibernate.cache.use_structured_entries=true
spring.jpa.properties.hibernate.cache.use_second_level_cache=true
spring.jpa.properties.hibernate.cache.use_query_cache=true
spring.jpa.properties.hibernate.cache.region.factory_class=com.boze.framework.hibernate.CustomRedissonRegionFactory
spring.jpa.properties.hibernate.cache.region_prefix=hibernate
spring.jpa.properties.hibernate.cache.redisson.config=file:./config/redisson/redisson-dev.yaml

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服