Announcement Announcement Module
Collapse
No announcement yet.
Spring JDBC - Please close it yourself? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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
    appedStatement.java:803)
    at org.jboss.resource.adapter.jdbc.WrappedStatement.g etGeneratedKeys(Wra
    ppedStatement.java:721)
    at org.springframework.jdbc.core.JdbcTemplate$3.doInP reparedStatement(Jd
    bcTemplate.java:720)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:
    460)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:7
    15)
    at org.springframework.jdbc.object.SqlUpdate.update(S qlUpdate.java:168)

  • #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?

    Comment


    • #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!

      Juergen

      Comment


      • #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.

        Comment

        Working...
        X