[jboss-user] [JNDI/Naming/Network] - Re: binding to local name space at startup

waynebaylor do-not-reply at jboss.com
Fri Sep 14 13:43:23 EDT 2007


you can do two things:
@Resource
  | private DataSource ds;
  | 
or
ejb-jar.xml:
  | <resource-ref>
  |     <description>DataSource</description>
  |     <res-ref-name>jdbc/MyDS</res-ref-name> 
  |     <res-type>javax.sql.DataSource</res-type>
  |     <res-auth>Container</res-auth>
  | </resource-ref>
  | 
  | jboss.xml:
  | <resource-ref>
  |    <res-ref-name>jdbc/MyDS</res-ref-name>
  |    <jndi-name>java:/MyDS</jndi-name>
  | </resource-ref>
  | 
  | your EJB code:
  | Context ctx = new InitialContext();
  | DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MyDS");
  | 

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

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



More information about the jboss-user mailing list