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 > clob db2 jdbc driver problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-19-09, 11:48
alkatal alkatal is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
clob db2 jdbc driver problem

Hi,

I am getting the following error via jdbc:

Code:
com.ibm.db2.jcc.a.SqlException: [jcc][1037][12036][3.52.95] Exception occurred during clob conversion.  See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
	at com.ibm.db2.jcc.a.ad.a(ad.java:650)
	at com.ibm.db2.jcc.a.ad.a(ad.java:60)
	at com.ibm.db2.jcc.a.ad.a(ad.java:85)
	at com.ibm.db2.jcc.a.ee.<init>(ee.java:114)
	at com.ibm.db2.jcc.t4.d.b(d.java:1463)
	at com.ibm.db2.jcc.a.fc.a(fc.java:845)
	at com.ibm.db2.jcc.a.fc.F(fc.java:1312)
	at com.ibm.db2.jcc.a.gl.d(gl.java:1035)
	at com.ibm.db2.jcc.a.gl.getString(gl.java:1013)
	at com.ibm.db2.jcc.a.gl.getString(gl.java:1465)
	at com.devoncdolitigation.client.TestJDBCdb.test(TestJDBCdb.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.internal****nners.TestMethod.invoke(TestMethod.java:59)
	at org.junit.internal****nners.MethodRoadie****nTestMethod(MethodRoadie.java:98)
	at org.junit.internal****nners.MethodRoadie$2****n(MethodRoadie.java:79)
	at org.junit.internal****nners.MethodRoadie****nBeforesThenTestThenAfters(MethodRoadie.java:87)
	at org.junit.internal****nners.MethodRoadie****nTest(MethodRoadie.java:77)
	at org.junit.internal****nners.MethodRoadie****n(MethodRoadie.java:42)
	at org.junit.internal****nners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
	at org.junit.internal****nners.JUnit4ClassRunner****nMethods(JUnit4ClassRunner.java:51)
	at org.junit.internal****nners.JUnit4ClassRunner$1****n(JUnit4ClassRunner.java:44)
	at org.junit.internal****nners.ClassRoadie****nUnprotected(ClassRoadie.java:27)
	at org.junit.internal****nners.ClassRoadie****nProtected(ClassRoadie.java:37)
	at org.junit.internal****nners.JUnit4ClassRunner****n(JUnit4ClassRunner.java:42)
	at org.eclipse.jdt.internal.junit4****nner.JUnit4TestReference****n(JUnit4TestReference.java:46)
	at org.eclipse.jdt.internal.junit****nner.TestExecution****n(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit****nner.RemoteTestRunner****nTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit****nner.RemoteTestRunner****nTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit****nner.RemoteTestRunner****n(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit****nner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.nio.charset.MalformedInputException: Input length = 19
	at com.ibm.db2.jcc.a.u.a(u.java:19)
	at com.ibm.db2.jcc.a.ee.<init>(ee.java:110)
	... 29 more
Caused by: sun.io.MalformedInputException
	at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:149)
	at com.ibm.db2.jcc.a.u.a(u.java:16)
	... 30 more
I don't have any probs accessing the clob with python (ibm_db2).
Seems like a driver problem because the data i uploaded to the clob field has a page-break char. Any idea how to solve this? Don't want to delete all the data and remove the page-break char (^L) from the csv files and load again.

thanks for the help
Reply With Quote
  #2 (permalink)  
Old 10-19-09, 11:59
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Would you mind posting your java code and the Db2 version and OS?

Andy
Reply With Quote
  #3 (permalink)  
Old 10-19-09, 12:06
alkatal alkatal is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
The jdbc test code is:
Same problem if used with hibernate
Code:
	@Test
	public void test() throws SQLException, ClassNotFoundException
	{
		String databaseURL = "jdbc:db2://zzzzz.com:57000/ns:fullyMaterializeLobData=true;fullyMaterializeInputStreams=true;progressiveStreaming=2;progresssiveLocators=2;";
		// Load DB2 Driver for JDBC class
		Class.forName("com.ibm.db2.jcc.DB2Driver");
		// Set user and password properties
		Properties properties = new Properties();
		properties.put("user", "xxx");
		properties.put("password", "xxxx");
		properties.put("retreiveMessagesFromServerOnGetMessage", "true");
		// Get a connection
		Connection conn = DriverManager.getConnection(databaseURL, properties); 
		String query="select * from xxx where proddate='8/21/2009'";

		Statement st = conn.createStatement();
		
		ResultSet rs =st.executeQuery(query);
		String prodid="";
		 while (rs.next())
	      {
//			 try
//			 {
				  prodid=rs.getString("PRODUCTIONID");
				 String s = rs.getString("FULLTEXT");
				 System.out.println(prodid);
				 System.out.println(s);
//			 }
//			 catch(com.ibm.db2.jcc.a.SqlException e)
//			 {
//				 e.printStackTrace();
//			 }
	      }
	}
}
db2 level:
Code:
B21085I  Instance "db2inst1" uses "64" bits and DB2 code release "SQL09052" 
with level identifier "03030107".
Informational tokens are "DB2 v9.5.0.2", "s080811", "MI00239", and Fix Pack 
"2".
Product is installed at "/opt/ibm/db2/V9.5".
uname -a
Code:
Linux db 2.6.26-1-xen-amd64 #1 SMP Fri Mar 13 21:39:38 UTC 2009 x86_64 GNU/Linux
Reply With Quote
  #4 (permalink)  
Old 10-19-09, 13:40
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What happens if you try to use rs.getClob?

Andy
Reply With Quote
  #5 (permalink)  
Old 10-19-09, 14:07
alkatal alkatal is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
same issue
Reply With Quote
  #6 (permalink)  
Old 10-19-09, 16:42
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Did you do

String s = rs.getClob

or

Clob c = rs.getClob

Andy
Reply With Quote
  #7 (permalink)  
Old 10-19-09, 16:54
alkatal alkatal is offline
Registered User
 
Join Date: Oct 2009
Posts: 4
Clob c = rs.getClob("FULLTEXT") throws the same exception.
and the Clob c object does not get constructed


there is no getClob method in the Resultset returning a string
Reply With Quote
  #8 (permalink)  
Old 10-20-09, 08:22
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Then I suggest you open a PMR with IBM to get the problem fixed.

Andy
Reply With Quote
  #9 (permalink)  
Old 03-24-11, 18:01
anthalamus anthalamus is offline
Registered User
 
Join Date: Oct 2010
Posts: 2
Hi, i have the exact same problem, no matter how i try and access that CLOB value, I get that exception. in all fairness the value contains charcters like X00, XFF and so on, but db2 load let me insert it without complaining (using LOBSINFILE)

even more interestingly though, i have:

Code:
(line 1) String string = resultSet.getString(i);
(line 2) Blob blob = resultSet.getBlob(i);
this will throw the exception at line 2, but if i comment out line 2, the exception is thrown from line 1! clearly a JVM bug, but kudos to DB2 for stepping right in it..!! it's made my colleagues and i laught a lot, until i realized that was a show stopper for me....
any suggestions?

Last edited by anthalamus; 03-24-11 at 18:02. Reason: forgot to format code
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