Hi Yoav

I am on a 24 hour response cycle at the moment, because my ISP is saving up
all the Tomcat-User emails and giving them to me once a day somewhere
between the time I go to bed and the time I get up!

This morning I had about 160 'new' messages :-)


> It allows the container to map your portable descriptor in web.xml to
> its specific instance in the container (which is defined in server.xml).
> So resource-ref is the same for your app in your dev, test, and
> production environments, on tomcat, weblogic, websphere, etc.  But the
> container-specific configuration elements change.  It's a way to map
> container-specific resources in a portable and consistent manner.  See
> also env-entry-ref...


Thank you for that explanation. (I always value your time.)

I read it a couple of times, and pondered it for a while, and in the end I
think I understood it (!)

Bearing in mind this is what the resource-ref element looks like in the
deployment descriptor:


<resource-ref>
     <description>My DB DataSource</description>
     <res-ref-name>jdbc/postgres</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
</resource-ref>


My understanding of it is that, even though I can get away without declaring
that element in my Tomcat deployment, I would need to restore it if I was to
deploy my application to (say) Weblogic, Websphere, etc.

That implies that the 'container-specific configuration' in Tomcat is to
actually use 'javax.sql.DataSource' as the resource type. IOW, the Tomcat
container creates a 'data-source' object and somewhere along the line it
wraps it up as a 'javax.sql.DataSource' object, so that when I get an
'Object' reference to it I can safely cast it to 'javax.sql.DataSource'.

That is what happens when I call:


    return ( DataSource )new InitialContext().
        lookup( "java:comp/env/jdbc/postgres" );


The suggestion is that on another container (Weblogic, etc.) would handed
some *other* type of data-source object, unless I informed the container
that I need a 'javax.sql.DataSource' type by including the resource-ref
element in my deployment descriptor.

If that 'understanding' is correct, Yoav, just say 'yes' or 'yep' or
something simple like that :-)

Kind regards

Harry Mantheakis
London, UK



















---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to