Problem in type casting an oracle connection
Issue
- We have a problem when trying to cast a connection using the following code:
@Resource(name="java:jboss/datasources/jdbc/testDS")
private DataSource ds;
public String getTest(Integer chiave) throws TestException {
String test = null;
String query = "SELECT a FROM test_table WHERE
b = ?";
try {
Connection conn = ds.getConnection();
WrappedConnection wc = (WrappedConnection) conn;
OracleConnection oc =
(OracleConnection)wc.getUnderlyingConnection();
OraclePreparedStatement ops =
(OraclePreparedStatement)oc.prepareStatement(query);
ops.setInt(1, test);
ResultSet rset = ops.executeQuery();
OracleResultSet orset =
(OracleResultSet)rset.unwrap(OracleResultSet.class);
while (orset.next()) {
XMLType xml =
XMLType.createXML(orset.getOPAQUE("test"));
if (xml != null) {
xbrl = xml.getStringVal();
logger.debug("test=" + test);
}
}
conn.close();
return test;
}
catch(Exception e) {
logger.error(e.getMessage(),e);
throw new
TestException(ExceptionErrorKey.111,Messages.getString(ExceptionErrorKey.111.name()));
}
}
- In
jboss deployment-structurewe include the dependency to the module:org.jboss.ironjacamar.jdbcadapters.Have you any idea?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
