If the name of the global resource in server.xml is defined as
<GlobalNamingResources>
   <Resource [attribs] name="jdbc/MYDATASOURCE"/>
   <ResourceParams name="jdbc/MYDATASOURCE">
         <param>...</param>
   </ResourceParams>
</GlobalNamingResources>


then the resourcelink in context.xml is

<Context [attribs]>
    <ResourceLink 
            global="jdbc/MYDATASOURCE" 
            name="jdbc/MYDATASOURCE" 
            type="javax.sql.DataSource"/>
</Context>

(not sure if listing the exact datasource specification would be a
security breach, so I'm munging the actual datasource name, but
everything else is the same, including upper/lower case)


On Tue, 21 Dec 2004 13:39:07 -0500, Phillip Qin
<[EMAIL PROTECTED]> wrote:
> What is the resourcelink in your context.xml?
> 
> 
> -----Original Message-----
> From: David Uctaa [mailto:[EMAIL PROTECTED]
> Sent: December 21, 2004 12:27 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Difficulty connecting to DB2 for iSeries from Tomcat 5.0.28
> 
> No matter what i do, the JNDI lookup is returning null.  What causes a JNDI
> lookup to return null when the resource is defined in the
> <GlobalNamingResources> section of server.xml?  Should I put the resources
> into <NamingResources> in my context.xml?
> 
> On Mon, 20 Dec 2004 13:52:29 -0500, David Uctaa <[EMAIL PROTECTED]> wrote:
> > I am running Tomcat 5.0.28 on Win XP SP1.  We have DB2 running on 2
> > iSeries servers.  When I attempt to look up a DataSource from JNDI to
> > get a connection from it, the JNDI lookup is returning null.
> >
> > I am using IBM's JTOpen library for the JDBC drivers, and I am
> > attempting to use Tomcat to manage the connection pooling.  I am
> > following the instructions I saw listed here:
> > http://www.itjungle.com/fhg/fhg060204-story01.html .   I am trying the
> > first option, using the Commons DBCP connection pool.
> >
> > I have attached copies of my server.xml and the context configuration
> > file webappname.xml.  The code I am using to access the data source is
> > pretty generic:
> >
> > Context initCtx = new InitialContext();
> > Context ctx = (Context) initCtx.lookup("java:comp/env"); DataSource ds
> > = (DataSource) ctx.lookup("jdbc/myFirstDataSource");
> > Connection conn = ds.getConnection();
> >
> > It turns out the that ctx.lookup call is returning null, as if it
> > can't find the JNDI resource, and I can't figure out what I have
> > misconfigured.
> >
> > Any and all help will be greatly appreciated.
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> !DSPAM:41c85cd9295551913319955!
> 
>

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

Reply via email to