If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > problem for reading DB2 DBCLOB data type

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-29-09, 16:40
caesarkim caesarkim is offline
Registered User
 
Join Date: Feb 2004
Posts: 11
problem for reading DB2 DBCLOB data type

I have a simple jdbc client reading different data types for DB2 unicode database. I am getting this error.

Here is my code..

java.util.Properties prop = new java.util.Properties();
prop.put("user", username);
prop.put("password", password);
String sql = "select * from data_types_table";
try {
Class.forName(driver);
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs1 = null;
try {
conn = DriverManager.getConnection(url, prop);
pstmt = conn.prepareStatement(sql);
rs1 = pstmt.executeQuery();
while (rs1.next()) {
System.out.println("1. column=" + rs1.getObject("DBCLOB1"));
}
} catch (SQLException e) {
e.printStackTrace();
}


com.ibm.db2.jcc.b.SqlException: [jcc][1037][12036][3.50.152] Exception occurred during clob conversion. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.db2.jcc.b.wc.a(wc.java:55)
at com.ibm.db2.jcc.b.wc.a(wc.java:84)
at com.ibm.db2.jcc.b.vd.<init>(vd.java:114)
at com.ibm.db2.jcc.t4.d.b(d.java:1448)
at com.ibm.db2.jcc.b.bc.a(bc.java:837)
at com.ibm.db2.jcc.b.bc.P(bc.java:1704)
at com.ibm.db2.jcc.b.jk.e(jk.java:1174)
at com.ibm.db2.jcc.b.jk.getObject(jk.java:1156)
at com.ibm.db2.jcc.b.jk.getObject(jk.java:1429)
at DB2Sample.testDB2Sample(DB2Sample.java:102)
at DB2Sample.main(DB2Sample.java:69)
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at com.ibm.db2.jcc.b.u.a(u.java:19)
at com.ibm.db2.jcc.b.vd.<init>(vd.java:110)
... 8 more
Caused by: sun.io.MalformedInputException: Reversed byte-order mark
at sun.io.ByteToCharUnicode.convert(ByteToCharUnicode .java:180)
at com.ibm.db2.jcc.b.u.a(u.java:16)
... 9 more


I have tried getBinaryStream, getCharacterStream, getAsciiStream, getClob, getBytes, getObject, getString. None of them works.

Does anybody why I am getting this and how to resolve? I think that it seems to be related to the data conversion inside the database when returning data.

I'd appreciated if someone gives me at least hint.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On