tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Dunn" <>
Subject RE: getConnection() returning a NULL JDBC driver
Date Mon, 02 Sep 2002 06:44:48 GMT
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"

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 []
Sent: Monday, 2 September 2002 12:13 PM
To: Tomcat Users List
Subject: Re: getConnection() returning a NULL JDBC driver


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"
    <ResourceParams name="jdbc/epantaidbPool">

And then here is the resource link for my application, also in server.xml.

<Context className="org.apache.catalina.core.StandardContext"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="false" debug="0"
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"/>

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,, and
for your reference. Hope that helps..


----- Original Message -----
From: "Robert Dunn" <>
To: "Tomcat Users List" <>
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'".
> error occurs when I attempt to call "ds.getConnection();". I have placed
> 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
> Shared/data/iitweb.gdb</value>
>     </parameter>
>   </ResourceParams>
> Thanks in advance, Rob :->
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message