On Tue, Aug 17, 2004 at 04:47:00PM -0400, Mark Lybarger wrote:
> i'm trying to figure out how to setup a data source within openejb. the
> examples i have seen thus far use a resource-ref to get to the
> datasource. the application i'm using doesn't use a resource-ref. it has
> a data source defined in weblogic, and the beans do a lookup to get a
> reference to that jndi name.
>
> i had read some perhaps old emailings that openejb only supported the
> jca, and didn't want to get into the business of connection pooling,
> etc. then again, maybe i misread.
We have a standard that jca-to-jdbc adapter that we use to run all
your data sources. The openejb.conf file contains a bunch of those
commented out as examples. These are the <Resource> tags.
>
> is it possible for me to configure openejb to make available a
> datasource outside of using a resource-ref?
This is a non-compliant feature that OpenEJB doesn't support. I'd
suggest you add the resource-ref tag if you can. It's the compliant
way to grab a data source.
Any easy way to work that into your code without having to change the
lookup strings you are using is to simply add an extra lookup as such:
context = (Context)context.lookup("java:comp/env"); // the new line
DataSource ds = (DataSource)context.lookup(MY_DATASOURCE_NAME);
Then you don't have to go updating all your static final variables. A
lookup on "java:" is a little slow as well due to VM code that has to
go looking for a JNDI provider, so getting the "java:comp/env" lookup
out of the way early is generally a good idea anyway.
>
> i took a look at the test suite for the geronimo integration, and
> there's some stuff in the rar that loads axion that seems to handle a
> "regular" datasource, but i'm not sure how to use it with an embeded
> openejb server. can i just add some of the stuff from the .rar to my
> openejb.conf?
That's the OpenEJB 2.0 code that you were looking at which isn't ready
for embedded testing. I added that local interface support to buy
people some time till we can get the OpenEJB 2.0 stuff up to par.
Hopefully, that can tide you over for a while.
-David
>
> thanks!
> ~mark