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

How to use connectionpooling for a datasource  RSS feed

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a datasource in WAS51 defined and I want to use the connection pooling. how do I have to write the code?

- get the inital context, the datasource and the connection each time required
- keep the context and get the datasource and the connction every time
- keep the datasource and get the connection everytime or
- keep the connection

what is the best way to do it? do I have to close the connection after each execution or is this managed by the server?

thanks
b
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What sort of application is this for? If its a web application, would you persist the context, datasource, or connection for multiple requests? The initial context is used for a lookup of the datasource. The datasource is a connection factory interface implemented by the vendor (IBM) to enable connection pooling, persisting that isn't useful either. And if you want to get a connection from the pool, why would you want to hang on to a connection? My understanding is very rudimentary, but I would suggest option 1 (feel free to correct me).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!