目录
- 简介
- 达梦数据库驱动
- 报错信息
- 排查
- 原因
- 解决
简介
1、对接达梦数据库
2、链接数据库时报错
3、达梦数据开启了大小写敏感
达梦数据库驱动
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.2.192</version>
</dependency>
报错信息
2024-08-01 15:52:05.518 - [ERROR] - [Druid-ConnectionPool-Create-630313530] - [com.alibaba.druid.pool.DruidDataSource - line:2781]: create connection SQLException, url: jdbc:dm://192.168.1.165:5236?schema=icip6&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8, errorCode -2103, state 3F000
dm.jdbc.driver.DMException: 第1 行附近出现错误:
无效的模式名[ICIP6]
at dm.jdbc.driver.DBError.throwException(DBError.java:711)
at dm.jdbc.a.b.o.x(MSG.java:591)
at dm.jdbc.a.b.o.C(MSG.java:526)
at dm.jdbc.a.b.o.B(MSG.java:507)
at dm.jdbc.a.a.a(DBAccess.java:245)
at dm.jdbc.a.a.a(DBAccess.java:729)
at dm.jdbc.driver.DmdbStatement.executeInner(DmdbStatement.java:730)
at dm.jdbc.driver.DmdbStatement.do_execute(DmdbStatement.java:190)
at dm.jdbc.driver.DmdbStatement.do_execute(DmdbStatement.java:182)
at dm.jdbc.util.DriverUtil.execute(DriverUtil.java:309)
at dm.jdbc.driver.DmdbConnection.do_setSchema(DmdbConnection.java:1227)
at dm.jdbc.driver.DmdbConnection.openConnection(DmdbConnection.java:644)
at dm.jdbc.desc.EP.connect(EP.java:159)
at dm.jdbc.desc.EPGroup$EPSelector.select(EPGroup.java:395)
at dm.jdbc.desc.EPGroup.connect(EPGroup.java:278)
at dm.jdbc.driver.DmDriver.do_connect(DmDriver.java:163)
at dm.jdbc.driver.DmDriver.connect(DmDriver.java:449)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1644)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1710)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2779)
排查
1、确认icip6数据库确实存在
2、查看报错信息,发现icip6数据库被自动转为大写,变成ICIP6数据库
原因
数据库名称被自动转为大写,导致找不到对应的数据库
解决
方法一:重新导入一个数据库名称为大写的数据库
方法二:更换达梦数据库驱动版本,该版本不会自动将数据库名称转为大写
<dependency>
<groupId>com.dameng</groupId>
<artifactId>DmJdbcDriver18</artifactId>
<version>8.1.3.140</version>
</dependency>