This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with PreparedStament close

 
sreedhar Lackka
Ranch Hand
Posts: 154
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Deepu Roy
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 154
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic