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 Fri, 13 Jul 2007 19:39:50 GMT

On Jul 13, 2007, at 2:37 PM, Glen Mazza 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.
> Thanks.  I will look into this.  I want to actually go both routes:
> 1.)  I am thinking of a read-only database with dummy data placed  
> into a WAR
> file.  I want to demonstrate XSL/XSLT report generation using any  
> sample
> data.  (Later, the user can modify the code to access any other  
> database
> desired.)  If I can place it in the WAR, then the webapp can  
> quickly access
> it "out of the box" from *any* servlet container.

Last I heard (several years ago) derby didn't support read only  
databases -- it needed somewhere to write locks or something like  
that.  Can derby work from a resource url?

> 2.)  For a more meaningful read-write production usage, doing as  
> you are
> saying above, and possibly documenting it on the Geronimo wiki so  
> others can
> use it/add to it.
>>> 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.
> I was not able to access it in client-server mode (accessing other  
> Derby
> DB's external to Geronimo's probably would not have been a problem  
> though.)
> Apparently the Derby database incorporated by Geronimo runs in  
> embedded
> mode--only the apps from one JVM can access it--so it can't be  
> accessed
> externally by Derby's "ij" query tool for example, unless Geronimo  
> itself is
> shut down.  (If you go to the "DB Info" page on the Geronimo  
> console, it
> says the Derby Embedded Driver is being used.)
> To test this, I tried to log into my sample Derby database I  
> created in
> Geronimo (located in geronimo/var/derby/mydbname) from ij -- it  
> failed when
> Geronimo was running, but worked after I shut down Geronimo.  I did  
> this
> last year with Derby standalone and documented it:
> [1] 
> entry=apache_derby_in_network_server

well, from this gbean in system-database:

     <gbean name="DerbyNetwork"  
         <reference name="derbySystem"><name>DerbySystem</name></ 
         <attribute name="host">localhost</attribute>
         <attribute name="port">1527</attribute>

and the success of a bunch of tck tests that use app client access to  
the derby instance running in the server, I'm pretty sure that the  
network connector is turned on and working.  Maybe the host=localhost  
rather than or a specific interface is the problem?  What  
connect string did you use for ij?

>>> 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.
> That's a clean design.
>> 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.
> Thanks.  I'll take a look at this.

Let us know if you have further problems!

david jencks

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

View raw message