Jump to content
Software FX Community

JDBCDataProvider and setDataSource() - When to close JDBC objects?


Recommended Posts

I'm using JDBCDataProvider and setDataSource() to create a chart in a servlet. I write the chart to the browser using getHtmlData().

 In my testing, it seems that I have to keep the resultset open till after my getHtmlData() call or I get a 500 error. But some of the examples seem to close the connection right after setDataSource(). What am I missing? TIA

Link to comment
Share on other sites

Thanks. I'm trying to pinpoint when the ChartServer object actually reads the ResultSet. This seems to be at getHtmlData() time.

This matters for jdbc cleanup. Closing the connection, but hoping the resultset will still be there...I wouldn't want to depend on that behavior. At any rate, I like to explicitly close the resultset, then the stmt, then the connection.  

Link to comment
Share on other sites

Yes, the resulset is read when you call either getHtmlData or getHtmlTag.  The problem you will find is that there is no way to close them after you call getHtmlData.

Bu you can use getHtmlDataEx, which will give you the chart stream, then you can close all object and send the chart to the browser when you are finished.  There are some getHtmlDataEx samples in the sample\misc folder of the installation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...