Hi
The url
below says how to extract a Oracle type Connection from JBOSS Wrapper
http://forums.oracle.com/forums/thread.jspa?messageID=1384788
No problem is getting the connection, but Do Not know how to close the same for
the obtained connection to be returned
The code is as given below
private
WrappedConnection WCP = null;
/**
* Singleton process
*/
public
static DBConnectionManager getInstance() throws InfinetException {
if (instance == null) {
synchronized
(DBConnectionManager.class) {
if
(instance == null) {instance = new DBConnectionManager(); }
}
}
return instance;
}
/**
* Get connection
*/
public
Connection getConnection()throws InfinetException{
Connection connx = null;
Connection underlyingConn = null;
try {
connx = ODS.getConnection();
WCP = (WrappedConnection)connx;
underlyingConn = WCP.getUnderlyingConnection();
connx = (OracleConnection)underlyingConn;
} catch (SQLException sqlex) {
sqlex.printStackTrace();
}
return connx;
}
/**
* Free connection
*/
public
void freeConnection(Connection con) throws InfinetException {
System.ou.println("RELEASING THE USED CONNECTION TO POOL");
try {
//@IMP JBOSS does not require this connection to close
//con.close();
//Close WRAPPER Connection
WCP.close();
}catch (Exception e) {
System.out.println("CAN'T CLOSE CONNECTION FOR POOL
");
e.printStackTrace();
}
}
Oracle-ds.xml
is as follows
<local-tx-datasource>
<jndi-name>jdbc/ORACLESCHEMA1</jndi-name>
<connection-url>jdbc:oracle:thin:@172.16.17.70:1521:SCHEMA1</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<user-name>SCHEMAUSERID</user-name>
<password>SCHEMAPASSWD</password>
<min-pool-size>10</min-pool-size>
<max-pool-size>60</max-pool-size>
<track-statements>false</track-statements>
<metadata>
<type-mapping>Oracle9i</type-mapping>
</metadata>
</local-tx-datasource>
>From jmx-console
“name=jdbc/ORACLESCHEMA1,service=ManagedConnectionPool”
We observe that with in 10 minuts “AvailableConnectionCount”
was become ‘0’
Any help
would be appreciated
SPEC
JBOSS 4.2.1
ORACLE DB : 10G DB
jar : ojdbc14.jar
j2sdk 1.4 for development
j2sdk1.6 for jboss runtime
with
regards
Karthik