-
1. Re: jndi lookup
lucvu Aug 12, 2002 11:26 AM (in response to bvallade)I know this is a little late to reply, but this might help whoever is reading this.
What you need to do is this:
<resource-managers>
<resource-manager>
<res-name>jdbc/MyDS</res-name>
<res-jndi-name>java:/MyDS</res-jndi-name>
</resource-manager>
</resource-managers> -
2. Re: jndi lookup
dokomesiter Nov 27, 2002 10:18 PM (in response to bvallade)Nope, doesn't seem to work, only the "java:/" works, trying to map to
the more portable "java:comp/env..." as you suggest fails, either not
finding the name in the context, or, even worse, apparently using the
wrong driver (maybe one of the developers would be interested in that)
C:\eclipse\workspace\Converter>ant run-junit
run-junit-jboss-client:
[junit] driverName=HSQL Database Engine Driver
[junit] OK (3 tests)
run-junit-sun-client:
[junit] .driverName=Mark Matthews' MySQL Driver
[junit] OK (3 tests)
And the few relevant lines in the files
jboss.xml
<resource-managers>
<resource-manager>
<res-name>jdbc/ODCSDS</res-name>
<res-jndi-name>java:/ODCSDS</res-jndi-name>
</resource-manager>
</resource-managers>
ejb-jar.xml
<resource-ref>
<res-ref-name>jdbc/ODCSDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
MyBean.java
DataSource dataSource = (DataSource) ic.lookup("java:comp/env/jdbc/ODCSDS");
return dataSource.getConnection().getMetaData().getDriverName();
mysql-service.xml
ODCSDS