db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Burlison <Alan.Burli...@sun.com>
Subject Re: embedded db and connection pooling
Date Wed, 04 Jun 2008 13:07:29 GMT
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:

Stand-alone connection pool manager:

Stand-alone DataSource:

Tomcat infrastructure needed to start/stop Derby & create/destroy the 
connection pool:

Alan Burlison

View raw message