> -----Original Message----- > From: Tim Lucia [mailto:[EMAIL PROTECTED] > Sent: Sunday, January 22, 2006 6:21 AM > To: 'Tomcat Users List' > Subject: RE: Setting up connection pools "on the fly"... > > The point of connection pooling is to eliminate the overhead > of setting up and tearing down a (TCP, database, AAA) > connection for every database transaction (typically, the web > request in a web app.) This can add 100s or 1000s of > milliseconds to every request, and is quite expensive. > > If you can architect your application so that there is a JNDI > data source for each server (database server, instance, etc.) > with its own pool of connections, you can always call > setCatalog > (http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.h > tml#setCatalog > (java.lang.String)) on the connection returned from the pool. > One doesn't typically add new database servers "on the fly", > and this option would require defining a new JNDI datasource > for a new server. Of course all catalogs processed in this > way must be accesible to the user specified in the > connnection pool properties. I would suggest setting the > defaultCatalog property as well, so that you are not > accidentally connected to the last-used catalog from the > previous borrower of the connection. > > Tim
Tim - If you could educate me on an aspect of this, I'd hugely appreciate it... What part of the standard set of calls for making a JDBC connection is the part that sets up the connection? Normally, all the tutorial stuff shows something like (assuming the Tomcat JNDI stuff is set up in context.xml): Get a context Get a datasource Get a connection Make the statements Close resultsets Close statements Close connection Is there a part of this that takes a lot of time? Part of what I need to do is handle database calls in a couple of different places (at least in the current design, which I'm the first to admin is likely not optimal). So that means figuring out how to get at the database in an effective manner as far as performance goes. I've seen a number of references to "setting up a connection takes a long time" - I'm not sure which of the calls is the part that takes a long time. Thanks... Warrick --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]