Announcement Announcement Module
No announcement yet.
Spring JDBC - Please close it yourself? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring JDBC - Please close it yourself?

    I'm seeing this error when I execute an SqlUpdate.update() method call. I wasn't aware that I had to close a result set with Spring JDBC. Where should I be doing this? The only place I see a resultset is in the mapRow methods of MappingSqlQuery objects; I am not otherwise doing JDBC calls outside of the framework. Thanks.

    16:23:26,776 WARN [WrappedConnection] Closing a result set you left open! Please close it yourself.
    java.lang.Exception: STACKTRACE
    at org.jboss.resource.adapter.jdbc.WrappedStatement.r egisterResultSet(Wr
    at org.jboss.resource.adapter.jdbc.WrappedStatement.g etGeneratedKeys(Wra
    at org.springframework.jdbc.core.JdbcTemplate$3.doInP reparedStatement(Jd
    at org.springframework.jdbc.core.JdbcTemplate.execute (
    at org.springframework.jdbc.core.JdbcTemplate.update(
    at org.springframework.jdbc.object.SqlUpdate.update(S

  • #2
    Spring should be closing it. Can you please post your code, so we can try to reproduce this? Is there anything unusual about your transactional set in JBoss?


    • #3
      Thanks for the report: There is indeed a close call missing in JdbcTemplate's generated keys access. I've added an explicit close call there.

      Usually, the Statement.close() call automatically closes all open ResultSets as well, so the lack of an explicit close call there shouldn't really hurt. Nevertheless, if we can close explictly, we should!



      • #4
        Glad to hear that. I was about to post a note to let you know that the problem typically occurs soon after I do an insert, and I am in fact using generated keys. I'll look forward to the update.