A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Where to release database connection before servlet gets destroyed?
Joined: May 17, 2010
May 18, 2010 08:12:12
If I have database connection in my
Can only one database connection in init() method will handle multiple client request?
Where to release that connection before servlet gets destroyed.(Unloaded from memory.) ?
Joined: Dec 11, 2004
May 18, 2010 08:21:46
I wouldn't keep a database connection in a servlet. At best it would become that servlet's performance bottleneck.
You're more likely to run into other issues that would be worse.
Look into container managed connection pools.
It's the standard and a much better way to go.
How to ask a question...
Simple Servlet Examples
Joined: Jan 26, 2007
May 19, 2010 01:09:33
Connection should always be get and returned to the connection pool as it has many advantages.
And connection should be returned to the pool as soon as you don't need that. Keeping connection in servlet is bad
I agree. Here's the link:
subject: Where to release database connection before servlet gets destroyed?
Connection Pooling and JSTL
Connection Object pointing to Null
NullPointerException running web applications.
load-on-startup tag Vs listener
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014