Announcement Announcement Module
Collapse
No announcement yet.
Where to close JDBC ResultSet after running JasperReport Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Where to close JDBC ResultSet after running JasperReport

    I try to integrate Spring web framework with JasperReport. It seems all of code examples online for Spring+JasperReport use collection as the data source. I couldn't find any example which uses JDBC ResultSet as the data source.

    I understand that when I use JDBC ResultSet as the data source, I need to wrap it with JRResultSetDataSource and pass it to one of the JapserReport views provided by Spring. However, my question is: where in the code can we close the JDBC ResultSet and Connection after JasperReport views render the report? This problem is similar to open session problem with Hibernate. But it seems that Spring hasn't provided a solution for JDBC-based data access in views. Any help is greatly appreciated.

    Thanks!

    Kenny

  • #2
    But it seems that Spring hasn't provided a solution for JDBC-based data access in views.
    Largely because we don't think it's a good idea. There is disconnected result set support in Spring 1.3 via the SqlRowSet interface.

    Keeping the result set open is error-prone.

    In your case, I would get, say a SqlRowSet, and transform and pass that to JasperReports. Then Spring will always close the ResultSet.

    Comment

    Working...
    X