File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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
Bookmark "Having A DB Connection Which Remains Opened" Watch "Having A DB Connection Which Remains Opened" New topic
Author

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30309
    
150

James,
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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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