Did you happend to find the solution for this issue. I am running into something similar to this. I have my EJB's and also some custom class which access the database. Both are using JNDI and are returning the connection back to the pool after creating the ResultSet(by closing the connection). I think that only the ResultSet is closed when we explictly tell it to close by calling rs.close(), or else if we close the statement. But by closing the Connectin object i never thought that it will close the ResultSet.
My problem here is the in the custom code where i access the database i do a JNDI lookup from the pool and then use this Connection to query the database (I tried closing and keeping open the Connection object). But when i try to do rs.next() i get an exception saying
'Operation not allowed after ResultSet closed'
I am using JBoss 4.0.2 and this code worked perfectly in JBoss 3.2.3 which was my app server and now i am trying to migrate to JBoss 4.0.2.
12:58:36,544 ERROR [ApplicationVersionBean] [select name, version_number from system_components order by name]
12:58:36,700 ERROR [ApplicationVersionBean] java.sql.SQLException: Operation not allowed after ResultSet closed
Thanks in advance,
I found out the solution.
in your -ds.xml add
<!-- 3.2.6 the default value for track-statements is 'nowarn' which closes Statement's and
ResultSet's without any warning, http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigDataSources
Correction, not in 3.2.6 but in 4.0.2 the default value is 'nowarn'
Thanks for the information about the solution. Your response with the solution arrived even before I could respond to your original post -- which wouldn't have helped you much, because I only had a hack of a work around. The solution that you've found works much better and is much easier to implement.
I never would have thought that almost a year and a half later that I'd find a solution. That's awesome! Thanks.