Oh!.. Robert, btw.., I used tomcat admin to add the ResourceLink...
try this url, http://localhost:8080/admin
go to your apps and add the link from there....

This will make sure the xml is generated properly.


----- Original Message -----
From: "Rosdi bin Kasim" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Monday, September 02, 2002 2:56 PM
Subject: Re: getConnection() returning a NULL JDBC driver


>
> Try this:
>
> DataSource ds = (DataSource) envCtx.lookup("jdbc/Transhub");
>
> and for your ResourceLink, try
>
> <ResourceLink global="jdbc/Transhub" name="jdbc/Transhub"
> type="javax.sql.DataSource"/>
>
> I dont know if that would make any difference.. but it works for me..
>
>
>
>
> ----- Original Message -----
> From: "Robert Dunn" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Monday, September 02, 2002 2:44 PM
> Subject: RE: getConnection() returning a NULL JDBC driver
>
>
> > Hi Rosdi,
> >
> > I tried your suggestions without much luck. When I create a context
> > reference to the  Interbase DB the code fails on the following line:
> >
> >    DataSource ds = (DataSource) envCtx.lookup("jdbcTranshub");
> >
> > with the error:
> >
> > Name jdbcTranshub is not bound in this Context
> >
> > The entry I created in the Server.XML file is:
> >
> > <Context path="C:\Program Files\Apache Group\Tomcat
4.1\webapps\transhub"
> > docBase="transhub" debug="0"
> >                  reloadable="true" crossContext="true">
> >           <ResourceLink global="jdbc/Transhub" name="jdbcTranshub"
> > type="javax.sql.DataSource"/>
> > </Context>
> >
> > Java code is:
> >
> > Context initCtx = new InitialContext();
> > Context envCtx = (Context) initCtx.lookup("java:comp/env");
> > DataSource ds = (DataSource) envCtx.lookup("jdbcTranshub");
> > Connection conn = ds.getConnection();
> >
> > Any other ideas?
> >
> > Thanks in advance, Rob.
> >
> > PS: I did remove the "Resource-Ref" out of the web.xml file as well.
> >
> > -----Original Message-----
> > From: Rosdi bin Kasim [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, 2 September 2002 12:13 PM
> > To: Tomcat Users List
> > Subject: Re: getConnection() returning a NULL JDBC driver
> >
> >
> > Robert,
> >
> > First of all.., I am using Oracle and Tomcat 4.1.9, so my answer might
not
> > apply to your problem..
> >
> > I got the same error like yours.. but after I removed all reference to
the
> > datasource in web.xml and
> > then I declared a ResourceLink like this in my server.xml my program is
> > running perfectly.
> >
> > Here is my global datasource in server.xml
> >
> > <Resource auth="Container" name="jdbc/epantaidbPool" scope="Shareable"
> > type="javax.sql.DataSource"/>
> >     <ResourceParams name="jdbc/epantaidbPool">
> >       <parameter>
> >         <name>username</name>
> >         <value>epuser</value>
> >       </parameter>
> >       <parameter>
> >         <name>url</name>
> >         <value>jdbc:oracle:thin:@localhost:1521:epantai</value>
> >       </parameter>
> >       <parameter>
> >         <name>password</name>
> >         <value>zaq12wsx</value>
> >       </parameter>
> >       <parameter>
> >         <name>maxActive</name>
> >         <value>20</value>
> >       </parameter>
> >       <parameter>
> >         <name>maxWait</name>
> >         <value>5000</value>
> >       </parameter>
> >       <parameter>
> >         <name>driverClassName</name>
> >         <value>oracle.jdbc.driver.OracleDriver</value>
> >       </parameter>
> >       <parameter>
> >         <name>maxIdle</name>
> >         <value>10</value>
> >       </parameter>
> >     </ResourceParams>
> >
> >
> > And then here is the resource link for my application, also in
server.xml.
> >
> >
> > <Context className="org.apache.catalina.core.StandardContext"
> > cachingAllowed="true"
> > charsetMapperClass="org.apache.catalina.util.CharsetMapper"
cookies="true"
> > crossContext="false" debug="0"
> > docBase="C:\jakarta-tomcat-4.1.9\webapps\mediline_upload"
> > mapperClass="org.apache.catalina.core.StandardContextMapper"
> > path="/mediline_upload" privileged="false" reloadable="false"
> > useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">
> >           <ResourceLink global="jdbc/epantaidbPool"
> > name="jdbc/epantaidbPool" type="javax.sql.DataSource"/>
> > </Context>
> >
> >
> > Then I create a singleton class to initialise the datasource, all my
codes
> > then get the connection from this singleton class.
> >
> > I attach the server.xml, web.xml, ConnCache.java, and
DatabaseManager.java
> > for your reference. Hope that helps..
> >
> > Regards,
> > Rosdi.
> >
> >
> >
> >
> > ----- Original Message -----
> > From: "Robert Dunn" <[EMAIL PROTECTED]>
> > To: "Tomcat Users List" <[EMAIL PROTECTED]>
> > Sent: Monday, September 02, 2002 9:37 AM
> > Subject: getConnection() returning a NULL JDBC driver
> >
> >
> > > Hi all,
> > >
> > > I am attempting to get a connection to the JDBC entry from the
> server.xml
> > > file and keep getting the error "Cannot load JDBC driver class
'null'".
> > The
> > > error occurs when I attempt to call "ds.getConnection();". I have
placed
> > all
> > > of the Interbase JAR files in the Common\Lib directory; Do I need
> > > to register these with Tomcat somehow?
> > >
> > > All of the files/system are detailed below. Any ideas would be
helpful.
> > >
> > > Platform:
> > >         WinXP
> > >         Tomcat 4.1.9 Stand Alone
> > >
> > > Java code:
> > >         Context initCtx = new InitialContext();
> > >         Context envCtx = (Context) initCtx.lookup("java:comp/env");
> > >         DataSource ds = (DataSource) envCtx.lookup("jdbc/Transhub");
> > >         Connection conn = ds.getConnection();
> > >
> > > The entry in the web.xml file is as follows:
> > >         <resource-ref>
> > >                 <description>Interbase JDBC</description>
> > >                 <res-ref-name>jdbc/Transhub</res-ref-name>
> > >                 <res-type>javax.sql.DataSource</res-type>
> > >                 <res-auth>Container</res-auth>
> > >         </resource-ref>
> > >
> > > Entry from the server.xml file is:
> > >
> > >   <Resource name="jdbc/Transhub" auth="Container"
> > > type="javax.sql.DataSource"
> > >         description="Resource name for the interbase client
> connection"/>
> > >   <ResourceParams name="jdbc/Transhub">
> > >     <parameter>
> > >       <name>description</name>
> > >       <value>Resource Parameters for the Transhub Interbase DB</value>
> > >     </parameter>
> > >     <parameter>
> > >       <name>maxActive</name>
> > >       <value>8</value>
> > >     </parameter>
> > >     <parameter>
> > >       <name>maxIdle</name>
> > >       <value>4</value>
> > >     </parameter>
> > >     <parameter>
> > >      <name>user</name>
> > >      <value>sysdba</value>
> > >     </parameter>
> > >     <parameter>
> > >      <name>password</name>
> > >      <value>XXXX</value>
> > >     </parameter>
> > >     <parameter>
> > >        <name>driverClassName</name>
> > >        <value>interbase.interclient.Driver</value>
> > >     </parameter>
> > >     <parameter>
> > >       <name>url</name>
> > >       <value>jdbc:interbase://localhost/C:/Program Files/Common
> > Files/Insfin
> > > Shared/data/iitweb.gdb</value>
> > >     </parameter>
> > >   </ResourceParams>
> > >
> > > Thanks in advance, Rob :->
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > >
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


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

Reply via email to