• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Is connection.close() sufficient?

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Calling connection.close in the finally block ensures that the connection is released ir still a reference is present to that connection and some additional measures need to be taken to release the connection?

Is it safe to do our own connection pooling or let the WAS connection pool handle it?
 
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gaurav,
If you are using a connection pool, close() returns the connection to the pool rather than actually closing it. This is the desired behavior.

If at all possible, you should let WAS handle connection pooling. In other words, you need a really good reason not to.
 
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Gaurav - You should be working with some kind of "framework" that supports connection poooling.

Pardons to Jeanne, but that does not necessarily mean WAS.

Guy
 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Some of the DB drivers require explicit closing of the ResultSet and Statments too. Some manage it on the clsoing of Connection. But generally, it is better to close ResultSet, Statement and Connection explicitly.
[ March 24, 2005: Message edited by: Annie Smith ]
 
Jeanne Boyarsky
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guy,
I only mentioned WAS because that's what Gaurav said he was using. While you could use a different connection pool, I would use the one provided by the app server.
 
No, tomorrow we rule the world! With this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic