Define a resource reference in web.xml, then map that to the JBoss jndi name in 
jboss-web.xml and look it  up (using the name defined in web.xml) from the container 
java:comp/env context.

web.xml:
<resource-ref>
  |     <res-ref-name>jdbc/myDS</res-ref-name>
  |     <res-type>javax.sql.DataSource</res-type>
  |     <res-auth>Container</res-auth>
  | </resource-ref>

jboss-web.xml:
<resource-ref>
  |         <res-ref-name>jdbc/myDS</res-ref-name>
  |         <jndi-name>java:/HypersonicDS</jndi-name>
  | </resource-ref>

Code:
InitialContext ic = new InitialContext();
  | DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/myDS");

Tim



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3849902#3849902

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3849902


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to