DBUNIT: exception when using xmlFlatFile to load to a table with a clob

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DBUNIT: exception when using xmlFlatFile to load to a table with a clob

brotherzilge
I am using dbunit-2.4.7 with Oracle 11g.  I have a flatxmlfile with one record. The request_info and response_info columns are clobs.

<dataset>
        <SERVLET_REQUEST REQUEST_ID="4565" STATUS="" REQUEST_INFO="some info" RESPONSE_INFO=""/>
</dataset>

I am getting the following exception when this test runs.  Can anyone help with this? Thanks


java.lang.RuntimeException: Unable to load database using DBUnit.
        at com.trgr.cobalt.categorypages.DBUnitUtil.load(DBUnitUtil.java:48)
...
Caused by: java.lang.RuntimeException: unexpected invocation exception: java.lang.String cannot be cast to oracle.sql.CLOB
        at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:137)
        at oracle.jdbc.driver.$Proxy35.setObject(Unknown Source)
        at org.dbunit.dataset.datatype.ClobDataType.setSqlValue(ClobDataType.java:71)
        at org.dbunit.database.statement.SimplePreparedStatement.addValue(SimplePreparedStatement.java:73)
        at org.dbunit.database.statement.AutomaticPreparedBatchStatement.addValue(AutomaticPreparedBatchStatement.java:63)
        at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:186)
        at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
        at com.trgr.cobalt.categorypages.DBUnitUtil.load(DBUnitUtil.java:38)
        ... 24 more
Reply | Threaded
Open this post in threaded view
|

Re: DBUNIT: exception when using xmlFlatFile to load to a table with a clob

John Hurst-2
Hello,

Looks like you are not using one of the (DbUnit) OracleDataTypeFactory classes. See the DataTypeFactory section in http://www.dbunit.org/properties.html, and perhaps try Oracle10DataTypeFactory. It causes CLOB values to be set slightly differently from the default ClobDatatype, which you are using.

Also, can you please confirm which JDBC driver you are using and whether you are using a THIN or OCI connection? I've used both ojdbc14 and ojdbc6 with CLOBs with Oracle, but neither of those JARs contains the oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory mentioned in your stack trace. Where does that class come from?

Regards

John Hurst
Wellington, New Zealand

On Sat, Jun 26, 2010 at 2:08 AM, brotherzilge <[hidden email]> wrote:

I am using dbunit-2.4.7 with Oracle 11g.  I have a flatxmlfile with one
record. The request_info and response_info columns are clobs.

<dataset>
       <SERVLET_REQUEST REQUEST_ID="4565" STATUS="" REQUEST_INFO="some info"
RESPONSE_INFO=""/>
</dataset>

I am getting the following exception when this test runs.  Can anyone help
with this? Thanks


java.lang.RuntimeException: Unable to load database using DBUnit.
       at com.trgr.cobalt.categorypages.DBUnitUtil.load(DBUnitUtil.java:48)
...
Caused by: java.lang.RuntimeException: unexpected invocation exception:
java.lang.String cannot be cast to oracle.sql.CLOB
       at
oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:137)
       at oracle.jdbc.driver.$Proxy35.setObject(Unknown Source)
       at
org.dbunit.dataset.datatype.ClobDataType.setSqlValue(ClobDataType.java:71)
       at
org.dbunit.database.statement.SimplePreparedStatement.addValue(SimplePreparedStatement.java:73)
       at
org.dbunit.database.statement.AutomaticPreparedBatchStatement.addValue(AutomaticPreparedBatchStatement.java:63)
       at
org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:186)
       at
org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
       at com.trgr.cobalt.categorypages.DBUnitUtil.load(DBUnitUtil.java:38)
       ... 24 more

--
View this message in context: http://old.nabble.com/DBUNIT%3A-exception-when-using-xmlFlatFile-to-load-to-a-table-with-a-clob-tp28986386p28986386.html
Sent from the DBUnit - Users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user



--
Life is interfering with my game

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user