Patches item #532376, was opened at 2002-03-20 09:02
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=532376&group_id=22866

Category: JBossServer
Group: v2.4 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Frank Karlstr�m (fjankk)
Assigned to: Nobody/Anonymous (nobody)
Summary: possible part of solution for bug#478882

Initial Comment:
We use JBoss 2.4.4 with catalina 4.0.1.
Our database is Microsoft SQL server 7.0.
Our database driver is DataDirect's Connect JDBC.
We use the Minerva Connection pool for Local 
Transactions.

After a while, our pool becomes unstable. 
I have figured this to be a problem with
org.jboss.pool.jdbc.PreparedStatementInPool
our code do like this:

/**********REPRODUCE-CODE **********/
Connection connection = null;
PreparedStatement statement = null;
ResultSet result = null;
try {
Context ctx = new InitialContext();
DataSource datasource = (DataSource)ctx.lookup
(DATABASE_JNDI_NAME);
connection = datasource.getConnection();
statement = connection.prepareStatement(SQL_STRING);
result = statement.executeQuery();
//loop the resultset
}catch(Exception e) {
//log this
}finally {
if(result!=null) try {result.close();}catch(Exception 
e) {e.printStackTrace();}
if(statement!=null) try {statement.close();}catch
(Exception e) {e.printStackTrace();}
if(connection!=null) try {connection.close();}catch
(Exception e) {e.printStackTrace();}
}



This should work just fine, but it does not. the 
resultset and the connection get closed, but the 
underlying preparedstatement is not closed.
in PreparedStatementInPool line 420-429 there seems to 
be missing a call to close() the underlying 
preparedstatement. 



/********** WORKAROUND **********/
instead of just calling:
statement close();

one could call:
((org.jboss.pool.jdbc.PreparedStatementInPool)
stmt).getUnderlyingPreparedStatement().close();
statement close();

This will correctly close the underlying 
preparedstatement and the pool will continue to work 
as expected.

/********** FIX **********/

add to org.jboss.pool.jdbc.PreparedStatementInPool
line 425:
if(impl!=null) {
impl.close();
}



I have not studied the rest of the pool classes, so I 
am not sure wether this fix will break something else.


Hope this was helpful. 

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376687&aid=532376&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to