Well I figured tomcat wasn't finding my driver when I didn't hard code it in 
setclasspath.sh because I didn't see it here:
Key is java.class.path --> 
/usr/local/java/lib/tools.jar:/usr/local/jakarta-tomcat-4.1.16/common/lib/commons-dbcp.jar:/usr/local/jakarta-tomcat-4.1.16/common/lib/commons-collections.jar:/usr/local/jakarta-tomcat-4.1.16/common/lib/commons-lang.jar:/usr/local/jakarta-tomcat-4.1.16/common/lib/commons-logging-api.jar:/usr/local/jakarta-tomcat-4.1.16/common/lib/commons-pool.jar:/usr/local/jakarta-tomcat-4.1.16/common/lib/classes12.jar:/usr/local/jakarta-tomcat-4.1.16/bin/bootstrap.jar

...when I printed out java.class.path and it showed up after I hardcoded the value.
Also, my other pages which don't use connection pooling weren't finding the driver 
until I hardcoded the value.
 
 
I took your example and put in my variables for server.xml:

<Context path="/inventoryServer" docBase="inventoryServer" debug="5" 
reloadable="false" crossContext="false">
 

        <Resource name="jdbc/inventoryPool" auth="Container" 
type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/inventoryPool">
        <parameter>
            <name>username</name>
            <value>myUsername</value>
        </parameter>
        <parameter>
            <name>password</name>
            <value>myPassword</value>
        </parameter>
        <parameter>
            <name>driverClassName</name>
            <value>oracle.jdbc.driver.OracleDriver</value>
        </parameter>
        <parameter>
            <name>url</name>
            <value> <mailto:jdbc:oracle:thin:[EMAIL PROTECTED]:1521:> 
jdbc:oracle:thin:myschema@myNode:1521:myInstance</value>
        </parameter>
        <parameter>
            <name>factory</name>
            <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>
        <parameter>
            <name>maxActive</name>
            <value>100</value>
        </parameter>
        <parameter>
            <name>maxIdle</name>
            <value>100</value>
        </parameter>
        <parameter>
            <name>maxWait</name>
            <value>100</value>
        </parameter>
        <parameter>
            <name>validationQuery</name>
            <value>SELECT 1 FROM dual</value>
        </parameter>
    </ResourceParams>
</Context>
 

 
My web.xml looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
 
<!DOCTYPE web-app  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"   " 
<http://java.sun.com/j2ee/dtds/web-app_2_3.dtd> 
http://java.sun.com/j2ee/dtds/web-app_2_3.dtd";>
 
<web-app>
<taglib>
        <taglib-uri> <http://java.sun.com/jstl/core> 
http://java.sun.com/jstl/core</taglib-uri>
        <taglib-location>/WEB-INF/c.tld</taglib-location>
 </taglib>
 <taglib>
        <taglib-uri> <http://java.sun.com/jstl/xml> 
http://java.sun.com/jstl/xml</taglib-uri>
        <taglib-location>/WEB-INF/x.tld</taglib-location>
 </taglib>
 <taglib>
        <taglib-uri> <http://java.sun.com/jstl/fmt> 
http://java.sun.com/jstl/fmt</taglib-uri>
        <taglib-location>/WEB-INF/fmt.tld</taglib-location>
 </taglib>
 <taglib>
        <taglib-uri> <http://java.sun.com/jstl/sql> 
http://java.sun.com/jstl/sql</taglib-uri>
        <taglib-location>/WEB-INF/sql.tld</taglib-location>
 </taglib>
 
<resource-ref>
 <description>Oracle Datasource example</description>
 <res-ref-name>jdbc/inventoryPool</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>
 
</web-app>

 
 
And I call my connection like this:
          Connection conn = null;
          Context initContext = new InitialContext();
          Context envContext  = (Context) initContext.lookup("java:/comp/env");
          DataSource ds = (DataSource) envContext.lookup("jdbc/inventoryPool");
          conn = ds.getConnection();
 
 
Am I do anything wrong with these?
 
 
 
thanks!


Troy Campano 
Database Management / Programmer 
Liberty Mutual 
(603) 245 4092 

-----Original Message-----
From: Jacob Kjome [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, December 08, 2002 3:27 PM
To: Tomcat Users List
Subject: RE: Tomcat 4.1, DBCP and Oracle



Yes, I have been able to do that.

When you say that Tomcat "doesn't automatically recognize the file in its
classpath", how do you know that?  And when you "hard code it in /bin/setclasspath.sh" 
and it "sees it", does your DataSource config now work?

If not, then there is a config problem.  You'll have to post your configuration in 
order to flesh that issue out.

One hint, make sure to use "username" and not "user" for DBCP configuration.  Attached 
is the DBCP config I use for your reference.

Jake

At 10:38 PM 12/7/2002 -0500, you wrote:



Hi, 
I've done this.
I renamed zip to jar. put it in /common/lib.
When I bounce tomcat...it doesn't automatically recognize the file in its
classpath, so I hard code it in /bin/setclasspath.sh, then it sees it.

I've set this up before. I have no problems setting this up with tomcat
4.0.X. It works like a charm. I've had the problem with 4.1.12 and not
4.1.16-beta.

I was working with someone on the Apache Bug database (is that the
tomcat-dev mailing list?). We didn't get anywhere.

So that's why I was wondering if there has been anyone who has successfully
able to hook up tomcat 4.1.12, DBCP and Oracle. 
Were you able to do it?

thank you for your help...it's greatly appreciated.

~ Troy Campano ~

-----Original Message-----
From: Jacob Kjome
To: Tomcat Users List
Sent: 12/7/02 2:57 PM
Subject: RE: Tomcat 4.1, DBCP and Oracle


1.  Rename classes12.zip to classes12.jar.  You don't have to repackage
the 
classes, simply rename the file.
2.  Put classes12.jar in CATALINA_HOME/common/lib.  That is the *only* 
place it can go because both the server and the application require
access 
to it.  Libraries under the common (jars in /lib or /endorsed and class 
files in /classes) directory are seen by both the appserver and webapps 
unlike stuff under /shared or stuff under /server.

Then follow the docs for configuration:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples
-howto.html

Jake

At 12:45 PM 12/7/2002 -0500, you wrote:
>Oh yeah...the error I get is:
>java.sql.SQLException: Cannot load JDBC driver class 'null'
>
>
>~ t r o y ~
>
>
> >  -----Original Message-----
> > From:         Campano, Troy
> > Sent: Saturday, December 07, 2002 12:44 PM
> > To:   '[EMAIL PROTECTED]'
> > Subject:      Tomcat 4.1, DBCP and Oracle
> >
> > Has anyone been able to get Tomcat 4.1.12 or Tomcat 4.1.16 working
with 
> DBCP and Oracle (classes12.zip)?
> > I've tried a billion combinations of configurations and nothing
works.
> >
> > I've see other people on the web have also had this problem.
> > I've tried for months to figure this out and I've opened bug cases,
but 
> nothing seems to work.
> >
> > Anyone able to do it?
> >
> > thank you!
> >
> > ~ Troy Campano ~

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

Reply via email to