I doubt there is connection pooling when you use the driver directly. There is connection pulling if you use java...DataSource I think. If you store the connection object in session then I suppose you could reuse it. Still using a DataSource implementation that does connection pooling is better. Check out the tomcat doc for how to specify a DataSource resource.
On 12/4/06, IT Desk <[EMAIL PROTECTED]> wrote:
This isn't Tomcat specific but general to any jsp container and its jvm. I am working on a site where almost everything is done through the jsp page plus one main java class to store state data. The site's jsp page may do up to 7 queries on the database. On each query, the statements are these: Driver DriverDB = (Driver)Class.forName(db_DRIVER).newInstance(); Connection ConnDB = DriverManager.getConnection(db_STRING,db_USERNAME,db_PASSWORD); PreparedStatement StatementDB = ConnDB.prepareStatement("SELECT * from table"); ResultSet resultDB = StatementDB.executeQuery(); My 2 questions are: Does the forName call to load the driver get optimized out? Clearly the driver need only load once. Does the getConnection reuse the same connection that was done in the previous call on the same jsp page? There are some performance problems and I'm wondering if I should try to clean the code up or if the jvm does it for me through optimization. It's running on Tomcat 5.5.20 and JVM 5.x. The client won't pay for any major redesign so I'm looking for something small that could make a big impact. Thanks for any insight. Coral --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- "talk trash and carry a small stick." PAUL KRUGMAN (NYT)