Hi,
> My connection pool however large gets used so JBOSS hangs waiting for a
> fresh unused connection. This problem is not in the application code
> rather something do with either the configuration of jboss or a bug in
> connection pool handling classes.
this IS application code issue.
There is a method which does not propperly close either ResultSet,
PreparedStatement or Connection!
make sure to ALWAYS use something like:
Connection con=null; PreparedStatement prepStmt=null; ResultSet
rs=null;
try {
DataSource _dataSource=null;
try {
InitialContext context = new InitialContext();
_dataSource = (DataSource)
context.lookup("java:comp/env/jdbc/somedb");
} catch (Exception nx) {
throw new SQLException("DS lookup failed (" + nx.toString()
+ ")");
}
con= _dataSource.getConnection();
prepStmt = con.prepareStatement("SELECT * FROM Table");
rs = prepStmt.executeQuery();
if( rs.next() ) {
//do something
}
} catch(SQLException Ex) {
log.error("Error accessing DataSource");
log.exception(Ex);
} finally {
if( rs!=null) try { rs.close(); } catch(Exception
Ex) { rs=null; }
if( prepStmt!=null) try { prepStmt.close(); } catch(Exception
Ex) { prepStmt=null; }
if( con!=null) try { con.close(); } catch(Exception
Ex) { con=null; }
}
so all DB-Pool related gets properly closed. (You may do a lookup on the
DataSource in setEntityContext, but you should NOT obtain a connection
there)
Burkhard
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user