Harry, Take a look at this page: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/globalresources.html
As noted on the page: "This is equivalent to the inclusion of the following element in the web application deployment descriptor (/WEB-INF/web.xml): " The question is: Is the fragment below inside a context for your application or is in the GlobalNamingResources section? I just swapped mine to Global and dropped the segment in the web.xml. I didn't try it while I had it in the context of the app. Doug www.parsonstechnical.com ----- Original Message ----- From: "Harry Mantheakis" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Monday, March 08, 2004 3:37 PM Subject: JNDI Datasource Reference in DD Not Necessary? > Hello > > For some time now I have implemented the Tomcat 'JNDI DataSource' How-To on > connection pooling, and everything has been fine. > > I define a resource in the context fragment: > > > <Resource name="jdbc/postgres" > auth="Container" > type="javax.sql.DataSource"/> > > <ResourceParams name="jdbc/postgres"> > ... > </ResourceParams> > > > And a resource reference to it in the deployment descriptor: > > > <resource-ref> > <description>DB Connection</description> > <res-ref-name>jdbc/postgres</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > > And then do a JNDI lookup at runtime: > > > return ( DataSource )new InitialContext(). > lookup( "java:comp/env/jdbc/postgres" ); > > > Magic. > > The other day I noticed that the resource reference in my deployment > descriptor was actually broken - the name did not match that defined in the > context - and yet my application was still working - perfectly. > > When I thought about it, it occurred to me that the resource reference in > the deployment descriptor may not actually be necessary. > > So I deleted the resource reference from the web.xml file, and everything > still works as expected. > > Can anyone enlighten me? > > Many thanks in anticipation. > > Harry Mantheakis > London, UK > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
