• 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Re: Freeing of resources  RSS feed

Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a qusetion about freeing of resources when I am using JDBC code.My application works pretty well for sometime and after sometime it behaves in a weird manner.Basically my application involves servlets talking to backend database and retreiving the results back.To remedy for the solution I have to restart my application server and you know what it works pretty well this time.In my JDBC code I did not close my statement but I did close my connection and it works fine.Also I am using the CreateStatement() in a try block.Is it advisable to use it there or put it before the try statement,could anyone please let me know of what exactly is happening here.
Thanking you,
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to close your result sets and statements or the database resources will eventually be used up. This is usually done in a finally block.
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!