We have a web app whose connection pooling code is modeled on basic example stuff on the web (classes like ConnectionPool, PooledConnection, etc), and my understanding is that when we restart Tomcat, all the ODBC connections will be reset on the database side. Now, we know that our particular ODBC driver has a problem which results in them not being reset sometimes, but generally it does release them.
Now, I'm wondering how the driver even knows to release them to begin with (when it's working right, I mean). Does Tomcat specifically tell the driver a special command to release all the connections or something like that?
Are you using DBCP, the built-in db connection pooling that comes with Tomcat, or your own customer pool?
If custom, then it's up to you to close down connections when your pool is on it's way out. Is this why you're asking about how Tomcat does it?
Joined: Jul 15, 2003
I didn't write the original code, but the connection pooling classes look like a lot of the example stuff on the web, and I think it's possible that it may even be an early version of the Apache group's connection pooling code (but slightly tweaked for our app).
I see that our connection object implements Connection, and since we have a method called close() that tries to get the db driver to close the corresponding connection on the db side, I'm assuming that when Tomcat is shutting down, then the Connection interface requires Tomcat to call the close method on each of those objects...
Does that sound right? We're pretty soon our connection pooling code isn't buggy, especially since I've been told that we once switched out the Apache group's package and there was no difference, but I'm just trying to eliminate possibilities...
(So to answer one of your questions, I don't think we're using Tomcat's built-in connection pooling...also, right now we're using Tomcat 4.27, I think).