当前位置:网站首页>Exception of DB2 getting table information: caused by: com ibm. db2.jcc. am. SqlException: [jcc][t4][1065][12306][4.25.13]
Exception of DB2 getting table information: caused by: com ibm. db2.jcc. am. SqlException: [jcc][t4][1065][12306][4.25.13]
2022-07-07 07:02:00 【Learn shameless realm】
Problem description :
DB2 edition :DB2 v10.5.0.11
When JDBC adopt JCC drive (db2 drive ) Of DatabaseMetaData Medium getTables Get the database table information and throw an exception :
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.25.13] Capture to java.io.CharConversionException. For more information , See connected Throwable. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.db2.jcc.am.b6.a(b6.java:794)
at com.ibm.db2.jcc.am.b6.a(b6.java:66)
at com.ibm.db2.jcc.am.b6.a(b6.java:125)
at com.ibm.db2.jcc.am.bh.a(bh.java:2963)
at com.ibm.db2.jcc.am.bh.p(bh.java:575)
at com.ibm.db2.jcc.am.bh.P(bh.java:1656)
at com.ibm.db2.jcc.am.ResultSet.getStringX(ResultSet.java:1225)
at com.ibm.db2.jcc.am.ResultSet.getString(ResultSet.java:1194)
at com.ibm.db2.jcc.am.ResultSet.getString(ResultSet.java:1787)
at com.geominfo.bi.meta.crawler.AbstractMetaCrawler.getTableAndRemarks(AbstractMetaCrawler.java:539)
... 80 common frames omitted
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
at com.ibm.db2.jcc.am.x.a(x.java:52)
at com.ibm.db2.jcc.am.bh.a(bh.java:2952)
... 86 common frames omitted
reason
When JCC When the data in the character column queried by the driver is not a valid string in the database code page ,JCC The driver will throw an exception .
Invalid data may have been entered into the database in the following ways :
Write byte values to the database by running SQL sentence . for example :INSERT INTO tab1 VALUES (X’C3’)
By running IMPORT or LOAD command , Therefore, the corresponding code page conversion was not performed . To ensure that it is running IMPORT or LOAD Complete the corresponding code page conversion , Please include the file type modifier ( Specify a code page instead x) To specify the code page of the input file .“codepage=x”
Diagnosis problem
You can use hexadecimal functions to find byte values in character columns .
for example , To find the table TAB1 in COL1 Byte value in column , Please run :
SELECT HEX(col1) FROM tab1
solve the problem
Use effective UTF-8 String update invalid data .
perhaps , For those who support it JCC Driver version , You can set JCC Configuration properties db2.jcc.charsetDecoderEncoder=3, In order to JCC The driver does not throw an exception , It's going back to Unicode Replace character (U+FFFD) Substitution is not effective UTF-8 Byte sequence of string .
JCC Configuration properties db2.jcc.charsetDecoderEncoder stay DB2 LUW 9.5 FP8 And higher (APAR IC74896)、DB2 LUW 9.7 FP 5 And higher (APAR IC74895) And from DB2 10.1 All that started DB2 LUW Supported in distribution .
for example , Suppose you have a Java Program MyApp.java It performs SQL Inquire about , The database column contains a byte sequence that is not a valid string .
Runtime :
It throws an exception . But when you run :
The string it returns contains any invalid byte sequence , These byte sequences are Unicode Replace character replace .
Unicode Replacement characters are usually as follows
java -Dfile.encoding=gb18030 -Ddb2.jcc.charsetDecoderEncoder=3 -jar MyApp.jar
Reference material :
https://www.itdaan.com/blog/2015/05/09/3f8fc9857f8b3de1669d63b3abaad6f1.html
https://www.ibm.com/support/pages/sqlexception-message-caught-javaiocharconversionexception-and-errorcode-4220
https://www.it1352.com/2818869.html
https://www.cnblogs.com/lpzpp/p/13986533.html
边栏推荐
猜你喜欢

RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`问题解决

二十岁的我4面拿到字节跳动offer,至今不敢相信

Jetpack compose is much more than a UI framework~

Mysql---- import and export & View & Index & execution plan

Bus message bus

Abnova 免疫组化服务解决方案

Several index utilization of joint index ABC

CompletableFuture使用详解

企業如何進行數據治理?分享數據治理4個方面的經驗總結

循环肿瘤细胞——Abnova 解决方案来啦
随机推荐
Linear algebra (1)
Networkx绘图和常用库函数坐标绘图
Please tell me how to monitor multiple schemas and tables by listening to PgSQL
请教一个问题,flink oracle cdc,读取一个没有更新操作的表,隔十几秒就重复读取全量数据
服装门店如何盈利?
Unity C# 函数笔记
2022/07/04学习记录
Stack and queue-p79-10 [2014 unified examination real question]
数据资产管理与数据安全国内外最新趋势
Cloudcompare point pair selection
7天零基础能考证HCIA吗?华为认证系统学习路线分享
多个kubernetes集群如何实现共享同一个存储
Libcurl returns curlcode description
Tool class: object to map hump to underline underline hump
基于JS的迷宫小游戏
Big coffee gathering | nextarch foundation cloud development meetup is coming
JDBC database connection pool usage problem
Distributed ID solution
AVL树的实现
Lvs+kept (DR mode) learning notes