背景:

mybatis查询Oracle报错:[ERROR] o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column ' ' from result set.  Cause: java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK...

原因:

提示缺少orai18n依赖包,但是会发现ojdbc8包中已经包含orai18n的依赖,所以我们尝试将orai18n的依赖显示的引入到我们的pom中

解决:

1.引入ojdbc依赖
<dependency>
    <groupId>com.oracle.database.jdbc</groupId>
    <artifactId>ojdbc8</artifactId>
    <version>19.3.0.0</version> 
</dependency>
2.引入orai18n依赖,需要显示的引入到pom
<dependency>
    <groupId>com.oracle.database.nls</groupId>
    <artifactId>orai18n</artifactId>
    <version>19.3.0.0</version>
    <optional>true</optional>
</dependency>

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐