jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases and the fly likes Having A DB Connection Which Remains Opened Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Having A DB Connection Which Remains Opened" Watch "Having A DB Connection Which Remains Opened" New topic

Having A DB Connection Which Remains Opened

James Gordon
Ranch Hand

Joined: Aug 09, 2002
Posts: 106
Hello All,

I'm building a web application login module.
Whenever a user login, the application would
access the database SEVERAL times to pick up
information for authentication. An average
of ~60 users would use the system.

I'm a bit worry about the data access portion.
If I would to get and close a database connection
on each login, is it better off if I just keep
a database connection which would be open
whenever the server is up, just to handle
this kind of request? Meaning I don't close it.

Connection pooling might be another way but my
argument is that I only need 1 connection
for that purpose, so pooling doesn't serve
much purpose there.

Please comment.

Thanks in advance.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32614

You could still use a very small connection pool. Even one with one connection. This is better than keeping the connection open because it could go stale.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link: http://aspose.com/file-tools
subject: Having A DB Connection Which Remains Opened
It's not a secret anymore!