更改了Gauss数据库后,更新了连接驱动,DBeaver能正常连接,但是idea上不行,同事跟我一样的代码也可以运行。
网上找了很多方法,我再提供一个方法。
我的报错,错误信息如下:
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLException: No suitable driver found for jdbc:postgresql://xx.xxx.xx.xxx:5432/gxcrm
### The error may exist in com.linkstec.lmsp.inner.commanager.po.SysComInfo
### The error may involve com.linkstec.lmsp.inner.commanager.po.SysComInfoMapperG.selectAllSimple
### The error occurred while executing a query
### Cause: java.sql.SQLException: No suitable driver found for jdbc:postgresql://xx.xxx.xx.xxx:5432/gxcrm
因为环境是内网环境,所以是离线环境,所以脱机打包的时候应该脱机依赖仓库也打包进去,把下面这个配置勾上就行了
还有一个办法是修改setting,不过目的都是为了脱机环境下把离线的本地仓库打包进去
setting.xml文件如下,仅供参考
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\jxh_xc_maven\M2Repository\</localRepository>
<!-- 本地仓库路径,因为现使用离线方式,可以注释掉 -->
<!-- <localRepository>D:/maven/maven_repo</localRepository> -->
<!-- 1. 找到 offline,设置离线模式,设置成 true -->
<offline>true</offline>
<!-- 2. 找到镜像 mirrors,设置离线模式 Maven 的镜像为本地仓库 -->
<mirrors>
<mirror>
<id>local-repo</id>
<mirrorOf>*</mirrorOf>
<name>central</name>
<url>file://C:/jxh_xc_maven/M2Repository/</url>
</mirror>
</mirrors>
</settings>