Glenn Nielsen wrote:
> 
> An approach that can address this problem for JSP1.1 containers is to
> provide the ability in DBTags to use the CachedRowSet.  CachedRowSet
> itself manages a connection to the db, opening it as needed.  Taking
> the logic for managing the connection out of the JSP page.
> 
> 
>http://developer.java.sun.com/developer/technicalArticles/javaserverpages/cachedrowset/

Maybe. A drawback is that you either have to provide it with a JDBC URL
plus user name/password, or with a J2EE compliant data source name.

With the former, connection pooling may be tricky: you need a JDBC driver
that wraps a pool, assuming the CachedRowSet implementation uses
DriverManager.getConnection(url, user, password) to get the connection.
I guess Poolman is implemented that way, so it can be done of course.

With the second method, you need a container that supports JNDI-configured
DataSources. A simple web container is not required to do that, even though
some (e.g. Tomcat 4.x) do.

The approach I described only requires a DataSource implementation in the
application scope. What's behind it and how it got there doesn't matter.
In my book I show a simple wrapper that implements DataSource that can
be used to wrap any existing first-generation connection pool. It's used
by the useDataSource tag. But you can also let a servlet place the 
DataSource in the application scope, possibly getting it from JNDI in
a J2EE container.

Hans
-- 
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com

Reply via email to