tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phillip Qin <Phillip....@shareowner.com>
Subject RE: Difficulty connecting to DB2 for iSeries from Tomcat 5.0.28
Date Tue, 21 Dec 2004 20:02:58 GMT
I assume you have something like this in your server.xml

<Resource name="jdbc/MYDATASOURCE" auth="Container" scope="Shareable"
type="javax.sql.DataSource" /> 

Is there any warning or exception in catalina.out or any other log files?

-----Original Message-----
From: David Uctaa [mailto:ductaa@gmail.com] 
Sent: December 21, 2004 1:52 PM
To: Tomcat Users List
Subject: Re: Difficulty connecting to DB2 for iSeries from Tomcat 5.0.28


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 <Phillip.Qin@shareowner.com>
wrote:
> What is the resourcelink in your context.xml?
> 
> 
> -----Original Message-----
> From: David Uctaa [mailto:ductaa@gmail.com]
> Sent: December 21, 2004 12:27 PM
> To: tomcat-user@jakarta.apache.org
> 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 <ductaa@gmail.com> 
> 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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


!DSPAM:41c870c3302641030564044!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message