mohan govind

Greenhorn
+ Follow
since Aug 24, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by mohan govind

Hi All,

I believe callableStatement.registerOutParameter is not supported in batch (callableStatement.addBatch()). Is this information mentioned in any spec/article and is there any other alternative for this?

Thanks in advance!
We are using stateless EJB for this enterprise service. A servlet handles the service request (around 10 million/day) and it in turn invokes the stateless EJB. EJB calls a business delegate (POJO) to get data from database and different external systems.

EJB gets the connection from pool using data source and passes it the delegate. But we need to make database (Oracle) calls in between invoking the external systems. So we make the database call and return the connection (connection.close()) to the pool. We return the connection to the pool to avoid holding the connection till the completion of the external system call.

We are getting connection not available errors. While debugging the issue we noticed that returned connection is not available in the pool.

Is there any property in EJB or connection pool that is holding the connection by the app even though we release it?

Getting connection in EJB:
connection = JDBCConnectionFactory.instance().getConnection();

Get connection method:
public Connection getConnection() throws AppDAOSystemException {
try {
Connection connection = dataSource.getConnection();
return connection;
} catch(SQLException sqlException) {
...
}
}

Return connection method:
public static void returnConnection(Connection connection) {
try {
if(connection != null) {
if(!connection.isClosed()) {
connection.close();
}
connection = null;
}
} catch(SQLException sqlException) {
...
}
}

Thank you all in advance for your help.
11 years ago