tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Louis Monteiro <jlmonte...@tomitribe.com>
Subject Re: Bind Datasource to specific jndi name
Date Mon, 24 Jun 2019 08:05:00 GMT
Hi,

Sorry for the delay.
I have looked at the question and there is an alias="name1,name2" attribute
you can use to define different aliases for the same resource.

It is useful when you are migrating from another app server.

That being said, the "java:" namespace in jndi is restricted per spec, so
I'm not sure you will be able to define the name you want.

Give it a try and let us know anyway.
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Fri, Jun 21, 2019 at 6:01 PM Kalyan <kalyanfremont@gmail.com> wrote:

> I really appreciate that.
>
> The problem i have is
>
> I created the datasource as
>
>  p.put("DS_DB", "new://Resource?type=javax.sql.DataSource");
>         p.put("DS_DB.JdbcDriver", "oracle.jdbc.OracleDriver");
>         p.put("DS_DB.JdbcUrl", "jdbc:oracle:thin:@xxxxxx:1521/rwdb");
>         p.put("DS_DB.UserName", "ds_user");
>         p.put("DS_DB.Password", "xxxxxxx");
>         p.put("DS_DB.LogSql", "true");
>         p.put("DS_DB.JtaManaged", "true");
>
>
> InitialContext initialContext = new InitialContext(p);
>
>             initialContext.bind("java:/DS_DB",new
>                     javax.naming.LinkRef("java:openejb:Resource/DS_DB"));
>
> Now i am trying to look up
>
> initialContext.lookup("java:/DS_DB")   :
> javax.naming.NameNotFoundException:
> Name "DS_DB" not found.
>
> But it works when i do
>
> initialContext.lookup("/DS_DB")
> initialContext.lookup("java:openejb:Resource/DS_DB")
>
> I am wondering, why it won't work with *java:/DS_DB*
>
> I am using openejb-core-8.0.0-M3 . version.
>
> thanks
> Kalyan
>
>
>
>
>
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message