tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "EDMOND KEMOKAI" <ekemo...@gmail.com>
Subject Re: jsp optimization for db driver load and connection
Date Mon, 04 Dec 2006 19:17:05 GMT
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 <ask@dataeffects.com> 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
"talk trash and carry a small stick."
PAUL KRUGMAN (NYT)

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message