Johnny Kewl wrote:
Robert, read the second paragraph... "per webapp basis"
This is what I think... if its set up for a global resource TC thinks
you using the dB across all webapps.
So the pool is set up and remains setup even when a new webapp is added.
In this case, deleting the dB and rebuilding is bad news because TC is
still using it.
But on a "per webapp" basis, you undeploy, do what you will, and on a
redeploy, the connections a remade for that webapp only.
It seems to just depent on whether you have the JNDI setup in sever.xml
(global) or web-inf/context (webapp only)
From later in that document:
----------
Use of the JDBC Data Sources JNDI Resource Factory requires that you
make an appropriate JDBC driver available to both Tomcat internal
classes and to your web application. This is most easily accomplished by
installing the driver's JAR file(s) into the $CATALINA_HOME/lib
directory, which makes the driver available both to the resource factory
and to your application.
----------
So even if the connection pool is per-app, it seems that the JDBC driver
still needs to be installed globally.
If you want to build a completely stand-alone webapp that starts up and
shuts down Derby you need to provide your own connection pool. For an
example, see the following:
Start up & shut down an embedded Derby instance:
http://auth.opensolaris.org/svn/showfile.svn?path=%2ftrunk%2fAuthDb%2fsrc%2forg%2fopensolaris%2fauth%2fdb%2fDbManager.java&revision=HEAD&name=auth
Stand-alone connection pool manager:
http://auth.opensolaris.org/svn/showfile.svn?path=%2ftrunk%2fAuthDb%2fsrc%2forg%2fopensolaris%2fauth%2fdb%2fMiniConnectionPoolManager.java&revision=HEAD&name=auth
Stand-alone DataSource:
http://auth.opensolaris.org/svn/showfile.svn?path=%2ftrunk%2fAuthDb%2fsrc%2forg%2fopensolaris%2fauth%2fdb%2fDbDataSource.java&revision=HEAD&name=auth
Tomcat infrastructure needed to start/stop Derby & create/destroy the
connection pool:
http://auth.opensolaris.org/svn/showfile.svn?path=%2ftrunk%2fAuthWebapp%2fsrc%2fjava%2forg%2fopensolaris%2fauth%2fwebapp%2fservlet%2fAuthListener.java&revision=HEAD&name=auth
--
Alan Burlison
--