Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Problem with PreparedStament close

 
Ranch Hand
Posts: 154
  • 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
 
Greenhorn
Posts: 9
  • 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

 
Greenhorn
Posts: 2
  • 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
  • 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
 
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic