Getting the exception Inconsistent java and sql object types: SYS.XMLTYPE while trying to connect database through Data source in JBoss EAP 6
Issue
- We have JBoss EAP 6.4.0 on standalone mode.
- We are facing below Exception when we are trying to connect database through Data source and there is no exception when the database connection is direct.
START Exception --->
Inconsistent java and sql object types: SYS.XMLTYPE
oracle.sql.OPAQUE.toClass(OPAQUE.java:395)
oracle.sql.OPAQUE.toJdbc(OPAQUE.java:333)
oracle.sql.OPAQUE.toJdbc(OPAQUE.java:314)
oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:227)
oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:123)
oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:2049)
oracle.jdbc.driver.OracleCallableStatementWrapper.getObject(OracleCallableStatementWrapper.java:818)
org.jboss.jca.adapters.jdbc.WrappedCallableStatement.getObject(WrappedCallableStatement.java:93)
...
<--- END Exception
- The JDBC code snippet looks like below:
Connection con = null;
CallableStatement st = null;
Document doc = null;
try
{
con = // invoke getConnection(...) to get the datasource connection from pool;
st = con.prepareCall("{call MyPROC(?,?,?,?,?,?,?,?)}");
st.setString(1, );
st.setString(2, );
st.setString(3, );
st.setString(4, );
st.setString(5, );
st.setString(6, );
st.setString(7, );
st.registerOutParameter(8, OracleTypes.OPAQUE, "SYS.XMLTYPE" );
st.execute();
doc = XMLType.createXML((OPAQUE)st.getObject(8)).getDOM();
return doc;
}
catch (Exception ex)
{
ex.printStackTrace();
}
finally
{
// invoke cleanUp(...);
}
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.4.x
- oracle
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.