当前位置:网站首页>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
边栏推荐
猜你喜欢
LVS+Keepalived(DR模式)学习笔记
MySQL的主从复制原理
带你刷(牛客网)C语言百题(第一天)
From zero to one, I will teach you to build the "clip search by text" search service (2): 5 minutes to realize the prototype
Navicat importing 15g data reports an error [2013 - lost connection to MySQL server during query] [1153: got a packet bigger]
MySQL SQL的完整处理流程
Answer to the first stage of the assignment of "information security management and evaluation" of the higher vocational group of the 2018 Jiangsu Vocational College skills competition
品牌电商如何逆势增长?在这里预见未来!
Lvs+kept (DR mode) learning notes
unity3d学习笔记
随机推荐
unity3d学习笔记
[noi simulation] regional division (conclusion, structure)
2022/07/04学习记录
使用TCP/IP四层模型进行网络传输的基本流程
. Net core accesses uncommon static file types (MIME types)
Please answer the questions about database data transfer
大咖云集|NextArch基金会云开发Meetup来啦
Several index utilization of joint index ABC
Kotlin之 Databinding 异常
请教一个问题,flink oracle cdc,读取一个没有更新操作的表,隔十几秒就重复读取全量数据
Basic introduction of JWT
Abnova 体外转录 mRNA工作流程和加帽方法介绍
Bus消息总线
SolidWorks GB Library (steel profile library, including aluminum profile, aluminum tube and other structures) installation and use tutorial (generating aluminum profile as an example)
【mysqld】Can't create/write to file
Linear algebra (1)
Unable to debug screen program with serial port
RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`问题解决
Under what circumstances should we consider sub database and sub table
Programmers' daily | daily anecdotes