File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
How to handle db connections in servlets?
Joined: May 20, 2002
May 23, 2002 03:03:00
How to efficiently handle db connections in
deployed in WAS4.0?
init method I am opening the connection and I am closing it in the destroy method ?
Is it correct ?
TAI,<br />Amudha L
Joined: Nov 06, 2000
May 23, 2002 05:39:00
I don't know if Websphere does it's own connection pooling. You may want to look into it though. Since it means that several hits to you servlet will share the same connection.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Joined: Dec 09, 2000
May 23, 2002 06:09:00
For a DB connection pool initialization the best means would be as
follows in decreasing order of preferance
1. Context Initialization
2. init() method
3. initialization on the receiving the first request.
Joined: Jun 13, 2000
May 23, 2002 07:06:00
Use a DataSource. IBM has a good example of setting this up at
Advanced application assembly and deployment tutorial
Once it's configured for your server, any example code for using a Connection from a DataSource will work.
I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
I agree. Here's the link:
subject: How to handle db connections in servlets?
hung jdbc connections
finalize() and cleanup
handle the Transaction on the DB side ?
sharing connection object within methods
XA vs non-XA
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015