Since you mentioned that you are using servlets, it looks like a Web application form, is it ?
Servlets are run under a J2EE application server
(Tomcat, JRun, WebLogic, WebSphere, etc.).
I have experience with WebLogic. Commonly a proper
technique is to use database connection pools
(rather than open a connection each time you get
a request). So you application server opens several
connections (in advance; when you configure
WebLogic server you can specify the initial number
of connections, the increment and the maximum
number of connections in the pool).
Whenever you nee to deal with the database in
your servlet, you request a connection from the pool
(of available connections), do your job and
once you are done, you have to return your connection back
to the pool, which you do by applying the close()
method to your connection.
Keep in mind, if you are getting a java.sql.Connection
object from the J2EE server connection pool its close()
method does not close the connection, it just marks it as
available for grabs from the pool.
This could be one of the potential causes of your problem.
I'd also recommend you to close your ResultSet objects
once you do not need them.
Provide more details on your environment,
may be we will be able to assist you better.