java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK

java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK

问题描述

在使用 Mybatis 操作 Oracle 数据库时,报以下错误:

 
 
 
1
2021-05-09 22:13:49.747 ERROR 7664 --- [nio-8081-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.exceptions.PersistenceException: 
2
### Error querying database.  Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'username' from result set.  Cause: java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK
3
### The error may exist in com/llm/mapper/oracleMapper/UserOracleMapper.java (best guess)
4
### The error may involve com.llm.mapper.oracleMapper.UserOracleMapper.findAll
5
### The error occurred while handling results
6
### SQL: SELECT * FROM "USER"
7
### Cause: org.apache.ibatis.executor.result.ResultMapException: Error attempting to get column 'username' from result set.  Cause: java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK] with root cause
8
9
java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK
10
at oracle.sql.CharacterSetUnknown.failCharsetUnknown(CharacterSetFactoryThin.java:233) ~[ojdbc8-19.8.0.0.jar:19.8.0.0.0]
11
at oracle.sql.CharacterSetUnknown.convert(CharacterSetFactoryThin.java:194) ~[ojdbc8-19.8.0.0.jar:19.8.0.0.0]
12
...
 
 

 

解决方法

maven 仓库,引入orai18n.jar

地址:https://mvnrepository.com/artifact/cn.easyproject/orai18n/12.1.0.2.0

 
 
 
1
<!-- https://mvnrepository.com/artifact/cn.easyproject/orai18n -->
2
<dependency>
3
    <groupId>cn.easyproject</groupId>
4
    <artifactId>orai18n</artifactId>
5
    <version>12.1.0.2.0</version>
6
</dependency>
 
 

 

posted on 2021-05-09 22:20  Windy心梦无痕  阅读(7236)  评论(0编辑  收藏  举报