geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Boynes <jboy...@gluecode.com>
Subject Re: Deploying a Data Source
Date Sun, 03 Oct 2004 00:15:00 GMT
Aaron Mulder wrote:
> 	I'm trying to set up a data source and access it from a web app.  
> I guess I need to somehow deploy a tranql service?  If there's an example 
> somewhere it would be helpful.  I think if I get the database in the 
> global JNDI space then I can use a resource-env-ref in web.xml and a
> naming:resource-env-ref in geronimo-jetty.xml and that should put it in my 
> web app's local JNDI space.
> 
> Thanks,
> 	Aaron

There is an example system-database-plan.xml that defines a DataSource 
for accessing the embedded Derby database. This uses the generic JDBC 
connector from TranQL and can be adapted to other vendor's drivers as 
needed. You use the same RAR file, just different deployment plans.

To access from a web app you need a <resource-ref> not a 
<resource-env-ref> - the Jetty plan looks like:

<web-app
   xmlns="http://geronimo.apache.org/xml/ns/web/jetty"
   configId="my_wars_config_id">

   <context-priority-classloader>false</context-priority-classloader>
   <resource-ref>
     <ref-name>jdbc/myDB</ref-name>
     <target-name>myDatasource</target-name>
   </resource-ref>
</web-app>

where <target-name> is the name of your datasource.

If you don't want an additional RAR config, I think you can actually 
embed its plan inside your geronimo-jetty.xml definition. Basically copy 
the <resource> element from the RAR plan and put it at the end of your 
web-app element (I know this works for app-clients).

--
Jeremy

Mime
View raw message