I have a table with a column of type XML. When I insert a record into this table from a servlet running in WebSphere on Windows, the insert succeeds. However, when I run exactly the same code in WebSphere on AIX, I get the following exception:
com.ibm.db2.jcc.c.SqlException: Illegal Conversion: Can not convert from "java.lang.String" to "java.sql.Blob"
at com.ibm.db2.jcc.c.r.a(r.java:695)
at com.ibm.db2.jcc.c.uf.b(uf.java:927)
at com.ibm.db2.jcc.c.uf.setString(uf.java:910)
at com.ibm.ws.rsadapter.spi.InternalGenericDataStoreHelper.psSetString(InternalGenericDataStoreHelper.java:554)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.setString(WSJdbcPreparedStatement.java:1662)
at org.hibernate.type.StringType.set(StringType.java:49)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:154)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:131)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2015)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2261)
... 33 more
I'm running WebSphere 6.1 against a DB2 version 9, z/OS database.
Because of the platform difference, this feels alot like an encoding problem. But who knows. Any advice?
This turned out to be a "problem" with the JDBC driver configuration.
Another application running in the same JVM was configured to use the v8 JDBC driver. Mine was configured to use the v9 JDBC driver. But because of the way classloading works, the first one on the classpath was loading for both (which just so happened to be the v8 driver, which didn't work for my application.)
The fix was to switch both applications to use the v9 driver (which was fine, because it's supposedly completely backward compatible.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With