This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Problem with PreparedStament close Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem with PreparedStament close" Watch "Problem with PreparedStament close" New topic
Author

Problem with PreparedStament close

sreedhar Lackka
Ranch Hand

Joined: Jul 05, 2008
Posts: 154
Hi,
I am using prepared statement to execute some query but when I verify the same code with some review tool it is giving me an error saying resource cant be released,
Please help me what to do,
Below is the code which I am writing,
Error which I am getting is,"Method may fail to clean up stream or resource " in the line where we are creating prepare statement


Please help me what to do

Regards,
Sree
thushara wijeratna
Greenhorn

Joined: Jan 28, 2009
Posts: 9
what review tool are you using and what is the exact message? it seems you are releasing resources correctly.

sreedhar Lackka wrote:Hi,
I am using prepared statement to execute some query but when I verify the same code with some review tool it is giving me an error saying resource cant be released,
Please help me what to do,
Below is the code which I am writing,
Error which I am getting is,"Method may fail to clean up stream or resource " in the line where we are creating prepare statement


Please help me what to do

Regards,
Sree


http://thushw.blogspot.com
Deepu Roy
Greenhorn

Joined: Aug 26, 2004
Posts: 2
Try enclosing each of the close statements in a try/catch block. In the code, if rs1 throws an exception, the close() method will not be called on the prepared statement and connection.
sreedhar Lackka
Ranch Hand

Joined: Jul 05, 2008
Posts: 154
Thanks.
Even I have written in my post also, the error which I am getting is "Method may fail to clean up stream or resource ".

Find bugs is the tool which I am using.

Regards,
Sree
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with PreparedStament close
 
Similar Threads
how to call a javabean method from jsp using setproperty
Operation not allowed after ResultSet closed
NULL POINTER eXCEPTION
Pool connection leak error
Facing problem in loading embadded image from xls sheet into oracle database