Results 1 to 4 of 4

Thread: Spring JDBC - Please close it yourself?

  1. #1
    Join Date
    Aug 2005
    Location
    Madison, WI
    Posts
    10

    Default 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. #2
    Join Date
    Aug 2004
    Location
    San Mateo, CA
    Posts
    1,265

    Default

    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?
    Rod Johnson - GM, SpringSource Division, VMware
    http://www.springsource.com
    Spring From the Source

  3. #3
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    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

  4. #4
    Join Date
    Aug 2005
    Location
    Madison, WI
    Posts
    10

    Default

    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.

Similar Threads

  1. Spring JDBC for unit tests?
    By amkush in forum Data
    Replies: 7
    Last Post: Aug 20th, 2008, 02:29 PM
  2. Replies: 2
    Last Post: Aug 31st, 2005, 12:37 PM
  3. Replies: 2
    Last Post: Jul 19th, 2005, 07:30 AM
  4. Replies: 1
    Last Post: Jun 13th, 2005, 06:31 AM
  5. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •