[jboss-user] [JCA/JBoss] - Re: How to name my JNDI(progress Connection pool) and call i
PeterJ
do-not-reply at jboss.com
Tue Oct 7 13:25:08 EDT 2008
According to your web-ds.xml file, you can look up the datasource using the name "":
ds = (DataSource) ctx.lookup("java:/web");
if that doesn't work, try "java:/web" (even I get confused as to whether the slash is required).
If you want to look up the datasource using your naming context (that is, via "java:/comp/env"), then you need to add the following to WEB-INF/web.xml:
<resource-ref>
| <res-ref-name>web1</res-ref-name>
| <res-type>javax.sql.DataSource</res-type>
| <res-auth>Container</res-auth>
| <res-sharing-scope>Shareable</res-sharing-scope>
| </resource-ref>
|
and the following to WEB-INF/jboss-web.xml:
<resource-ref>
| <res-ref-name>web1</res-ref-name>
| <jndi-name>java:web</jndi-name>
| </resource-ref>
Then in your code use:
ds = (DataSource) ctx.lookup("java:/comp/env/web1");
I changed the name in the code to 'web1' so that you could see how that maps to the web.xml, which in turn maps to the jboss-web.xml, which in turn changes the name to simply 'web' which then matches the name in the *-ds.xml file.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4180843#4180843
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4180843
More information about the jboss-user
mailing list