geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: Derby DB in Geronimo
Date Thu, 12 Jul 2007 16:15:24 GMT

On Jul 12, 2007, at 11:44 AM, gmazza wrote:

> Hello,
> I am thinking of using the DerbyDB embedded in Geronimo for a web
> application.  I have a couple of questions about the Derby that is in
> Geronimo:

A couple of comments.

I think you are going to need an ear file or a geronimo "synthetic  
ear" or at least 2 artifacts -- a rar for the database pool and your  
web app.  I think you may find an ear with "external modules" for the  
db pool is the simplest: you can include the geronimo plan inside the  
ear and have only one deployable.  The daytrader app shows how to do  
this in e.g the plans/daytrader-g-2.0.xml plan  (I might not quite  
have the name right) although that plan is not included in the ear.
> 1.)  Does Geronimo's Derby run in embedded mode or network server  
> mode?  If
> the former (which I believe but would like to confirm), does that  
> mean I
> would need a separate instance of Derby if I want to run in Network  
> server
> mode?

You can access derby from geronimo using either embedded or network,  
depending on which tranql resource adapter you use.  AFAIK embedded  
is likely to be a bit faster.

> 2.)  Is it possible (or practical) to embed Derby within a web  
> application
> WAR file, preconfigure it with sample tables and rows, etc., and  
> have the
> webapp access *that* embedded Derby instance, and not the one that  
> comes
> with Geronimo (or any network server version possibly running on the
> machine)?  I am asking this because it would be nice for a sample web
> application if I could configure it such that no database  
> configuration
> would be necessary for a user; they would just need to deploy the  
> WAR and it
> will work out-of-the-box.

I don't think its practical or a good idea to run the database  
actually in the war file.  For one thing it really ought to be read  
only if you did that :-)
What I recommend is to construct your starting database, wrap it up  
in a jar file, include the jar in the ear or war file, and include a  
gbean in the geronimo plan to unpack the jar file into the var/derby  
directory.  Our intent is that all program modifiable data files such  
as embedded databases should go somewhere in var.

We have an example of doing almost exactly this in geronimo, in the  
uddi app.
applications/geronimo-uddi-db constructs the db and packs it in a jar
applications/geronimo-uddi-server constructs the war file
configs/uddi-jetty6 (and uddi-tomcat) "predeploy" uddi into the jetty  
or tomcat server, constructing what is basically a geronimo plugin.

Unless you want separate jetty and tomcat plugins or only want to  
support one web server I recommend you have an ear file with the db  
jar and war and the plan in the jar.

Hope this helps.... ask more questions if it's not clear how to proceed.

david jencks

> Thanks,
> Glen
> -- 
> View this message in context: 
> Geronimo-tf4068958s134.html#a11562877
> Sent from the Apache Geronimo - Users mailing list archive at  

View raw message