users@glassfish.java.net

Re: looking up datasource using java:comp/env/jdbc prefix

From: Sanjeeb Sahoo <Sahoo_at_Sun.COM>
Date: Thu, 17 Jun 2010 10:13:29 +0530

Yes, resource-ref will work. The same can be acheived using annotation
like this:

@Resource(name="jdbc/test", mappedName="Use the actual JDBC resource
name as created in the system")

You can annotate any of the component class (e.g., a servlet or EJB)
with this annotation and there after in the scope of that component,
your JNDI lookup will work.

Sahoo

On Thursday 17 June 2010 10:03 AM, glassfish_at_javadesktop.org wrote:
> Probably, you need to define<resource-ref> in your component's descriptors
> eg: web.xml and sun-web.xml for web component
> or
> ejb-jar.xml and sun-ejb-jar.xml for EJBs.
>
> Following blog might be of help which explains about defining resource-ref :
> http://thestewscope.wordpress.com/2008/01/08/glassfish-v2-ur1-and-mysql-connection-pool/
> [Message sent by forum member 'jr158900']
>
> http://forums.java.net/jive/thread.jspa?messageID=474612
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>