tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Bind Datasource to specific jndi name
Date Mon, 15 Sep 2008 22:29:32 GMT

On Sep 9, 2008, at 5:53 AM, Andreas Karalus wrote:

> hello,
> i've configured a datasource like this
> <Resource id="operativDS" type="DataSource">
>    JdbcDriver  oracle.jdbc.driver.OracleDriver
>    JdbcUrl      jdbc:oracle:thin:@localhost:1521:orcl
>    UserName    scott
>    Password    tiger
> </Resource>
> is it possible to bind the datasource to a specific jndi name?  
> especially, I
> would like to bind the datasource to "java:/operativDS"

Everything in the config is bound to something that closely matches  
its path in the openejb.xml file.  So for example:

   <Resource id="operativDS" ...>

Is bound to:

   new InitialContext().lookup("java:openejb/Resource/operativDS");

If you wanted to make it available at a different name, you could  
easily add the link yourself with some code like this after OpenEJB  
has been embedded:

   InitialContext context = new InitialContext();
   context.bind("java:operativDS", new  


View raw message