springboot--jpa连接达梦数据库
·
springboot–jpa连接达梦数据库
读取插入指定模式下的数据库表格时
1.先在达梦上创建新用户,创建用户成功后会自动创建与该用户同名的模式名。
2.在配置springboot的配置文件时,在jpa的配置下,配置上default_schema,路径为jpa->properties->hibernate->default_schema,值为要访问的具体的模式的名称
datasource:
url: jdbc:dm://{ip}:{host}/{schema}?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
username: xxxx
password: xxxx
driver-class-name: dm.jdbc.driver.DmDriver
type: com.alibaba.druid.pool.DruidDataSource
jpa:
show-sql: true
# generate-ddl: true
hibernate:
# ddl-auto: update
ddl-auto: none
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties:
hibernate:
enable_lazy_load_no_trans: true
default_schema: TEST
- 为了避免一些莫名其妙的问题,创建的表名以及字段名都采用大写的模式。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)