You cant. Here the solutions for portability i have in mind now:
1) use relative naming for injections
2) use java:app or java:global (on snapshot i guess, no more sure)
Le 5 sept. 2012 18:34, "laredotornado" <[email protected]> a écrit :

> Thanks for the reply.  The pattern was indeed
> "java:openejb/Resource/MySqlDS".  However, I'm using some Spring code that
> relies on JBoss-style JNDI names for the datasource, so it's expecting
> "java:MySqlDS".  How can I make the resource get bound to that?  I've tried
> using the "openejb.jndiname.format" property ...
>
>             final Properties props = loadMyProjectProps();
>             final String dsJndiName = "MySqlDS"; ;
>             p.put(dsJndiName, "new://Resource?type=DataSource");
>             p.put(dsJndiName + ".JdbcDriver", "com.mysql.jdbc.Driver");
>             final String url = "jdbc:mysql://" +
> props.getProperty("DB_SERVER") +
> ":" + props.getProperty("DB_PORT") + "/" + props.getProperty("DB_NAME");
>             p.put(dsJndiName + ".JdbcUrl", url);
>             p.put(dsJndiName + ".Username", props.getProperty("DB_USER"));
>             p.put(dsJndiName + ".Password",
> props.getProperty("DB_PASSWORD"));
>             p.put(dsJndiName + ".JtaManaged", "true");
>             p.put("openejb.jndiname.format", "{ejbName}");
>             final InitialContext initialContext = new InitialContext(p);
>
> but it's having no effect -- the datasource still gets bound to
> "java:openejb/Resource/MySqlDS".  Thanks for any additional help, - Dave
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/What-JNDI-name-does-a-datasource-get-bound-to-tp4657277p4657295.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Reply via email to