Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2004

Tip: Looking for answers? Try searching our database.

Holding Static data links?

Thread view: 
Mark - 07 Mar 2004 01:44 GMT
Hello!

 I have designed a website with a servlet that holds on to a database
connection statically so as not to have to re-establish the data connection
with every single page request. (and it detects if the link went down, of
course).  This connection has a bunch of prepared statements on it to make
things easier.

 Now, the question is:  Am I begging for trouble by doing this?  What
happens if two page requests come in extremely close together?  Is there a
guarantee that the servlet will only process one page at a time?  Could it
be that two page requests will come in and cause the database connections
to step on each other?

 Thanks!

 mark.

Signature

-- I am not an ANGRY man.  Take the rage out of my e-mail address to reply
please.

Stephen David - 08 Mar 2004 01:30 GMT
Mark,

Servlets are multi-threaded -- if you're saying that each instance of your
servlet gets its own database connection (preferrably from a connection
pool), then you should be okay.  On the other hand, if you have a database
connection that is a singleton object that you're sharing between servlet
threads, i believe you  may be asking for trouble.

I'd recommend utilizing third party connection pooling software, as it will
take care of 'dead' connections, keeping a min/max # of connections open,
etc.  For decent open-source connection pooling software, check out
http://proxool.sourceforge.net/.

Steve David

> Hello!
>
[quoted text clipped - 13 lines]
>
>   mark.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.