Skip to Content
avatar image
Former Member

How to close ReportClientDocument in Crystal reports for JAVA

We are using JAVA Crystal Reports to make WEB report (Oracle database) . Everything appears to the fine. However, we discovered a problem that the Crystal report makes dedicated DB connection each time when a report viewer is opened (with the help of

ReportClientDocument) this connection can be viewed in V$Session view.

The true problem is that the database entry remains open even if the report object is out of scope. If I close the ReportClientDocument before or after the report generation (viewer.dispose()) then the report will generate fine, but the report pagination would not work.

Our architecture is using Spring MVC (JAVA) with singleton service in the controller. Our question is how the DB connection can be closed with this type of architecture?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Dec 17, 2018 at 10:18 PM

    The crystalreportviewer requires the reportclientdocument object to be active and available in order for page navigation to work. There is no way around that. In addition, depending on how the report was viewed (if you allowed it to prompt for parameters), the viewer may have a reference to the reportclientdocument object - which would mean it cannot be closed until the viewer is disposed of.

    Lastly, the report engine uses database connection pooling - but if you close/dispose of the reportclientdocument object, you should see the database connection close after a short while - it will generally not close immediately.

    If you want to be able to view the report and close the reportclientdocument object, I recommend you export to PDF and view that.


    Add comment
    10|10000 characters needed characters exceeded

  • Jun 25 at 07:17 PM

    Shawn Penner I see the same issue in my application too. I see that my db connection is still not closed even after calling close on reportclientdocument. Is their a way i can force the connections to be closed after the crystal report is rendered/closed?

    Add comment
    10|10000 characters needed characters exceeded