users@glassfish.java.net

Re: JDBC resource via JNDI

From: <glassfish_at_javadesktop.org>
Date: Thu, 08 Feb 2007 13:44:43 PST

The sun-*.xml jndi-name mappings do not declare a dependency. They just map an existing
dependency to a global resource. The sun-web.xml resource-ref mapping serves
the same purpose as the mappedName attribute of the @Resource annotation. Either way,
you still need to declare the dependency in the first place. That can be done either
via a standard deployment descriptor, which in this case would be web.xml, or via the
@Resource annotation. In web.xml it would look like this :

<resource-ref>
        <res-ref-name>jdbc/edm</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

We have a presentation that explains some of this material in more detail here :

https://glassfish.dev.java.net/javaee5/ejb/compdependencies_xmlforum_nov15.pdf

 --ken
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=202730