Use the ejb-jar.xml to specify what is in your ENC and jboss.xml to map it to 
the JNDI name.

For example, to have access to the default datasource, java:/DefaultDS, you 
would use the following:

  | <ejb-jar  ...>
  |     <enterprise-beans>
  |         <session>
  |             <ejb-name>MySessionBean</ejb-name>
  |             <local>my.local.MySessionLocal</local>
  |             <ejb-class>my.bean.MySessionBean</ejb-class>
  | 
  |             <resource-ref>
  |                 <res-ref-name>jdbc/MyDataSource</res-ref-name>
  |                 <res-type>javax.sql.DataSource</res-type>
  |                 <res-auth>Container</res-auth>
  |             </resource-ref>
  |         </session>
  |     </enterprise-beans>
  | </ejb-jar>
  | 
and

  | <jboss ...>
  |     <enterprise-beans>
  |         <session>
  |             <ejb-name>MySessionBean</ejb-name>
  |             <resource-ref>
  |                 <res-ref-name>jdbc/MyDataSource</res-ref-name>
  |                 <resource-name>DefaultDS</resource-name>
  |             </resource-ref>
  |         </session>
  |     </enterprise-beans>
  | </jboss>
  | 

and perform the lookup within MySessionBean as:
DataSource ds = (DataSource)new 
InitialContext().lookup("java:comp/env/jdbc/MyDataSource");

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081454
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to