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
Mark <ne**@ANGRYlanfear.com> wrote in message news:<R7v2c.130526$4o.169281@attbi_s52>...
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.