-
1. Re: Oracle JDBC Extensions, problem
wdfink Nov 8, 2013 6:21 AM (in response to altar)1 of 1 people found this helpfulYou can use the normal lookup for a datasource and get the underlying connection. But you need to close the original retrieved one otherwise JBoss can not handle the connection correctly.
Please share your code that we can understand what you are doing and what the issue is.
-
2. Re: Oracle JDBC Extensions, problem
altar Nov 8, 2013 8:10 AM (in response to wdfink)Yes you right and that was my problem, after a long research I have found the solution
I was closing the underlying connection and never the native connection which was always active, meaning that the pool was exhausted very quickly
to help people with the same problem
add this method to retrieve the underlying OracleConnection :
import java.lang.reflect.Method;
public static OracleConnection getOracleConnection(Connection conFromPool) throws SQLException {
try {
Class[] parms = null;
Method method = (conFromPool.getClass()).getMethod("getUnderlyingConnection", parms);
return (OracleConnection) method.invoke(conFromPool, parms);
} catch (InvocationTargetException ite) {
throw new SQLException(ite.getMessage());
} catch (Exception e) {
throw new SQLException(e.getMessage());
}
}
in the services that needs to use Oracle Data Objects :
Connection conn = null;
OracleConnection oraConn=null;
OracleResultSet rset = null;
OracleCallableStatement stmt = null;
conn = this.getConnection(ctx);
oraConn = getOracleConnection(conn);
// do your work using oraConn
// close the native connection
conn.close();
conn=null;
-
3. Re: Oracle JDBC Extensions, problem
wdfink Nov 8, 2013 11:21 AM (in response to altar)That's correct, from a performance perspective you might not use reflection but cast to the JBoss connection wrapper.
Also you should mark the helpful/correct posts and set the thread to answered, it makes it more easy for others to find the solution