tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vance Christiaanse" <cint...@twcny.rr.com>
Subject DB2 DataSource: No suitable driver
Date Wed, 28 Aug 2002 21:01:29 GMT
Hello, Tomcat fans,

I am using Tomcat 4.0.4 and can't get a DataSource working
with DB2.

My attempts result in "No suitable driver", as detailed below.

I have tried everything I've seen suggested for
this problem, as the following steps indicate.

Any help would be much appreciated.

Thank you in advance,

Vance Christiaanse

==============================================

1. Applied FixPack 7 (the latest fixpack) to DB2 7.2

2. Successfully ran usejava2 (to convert DB2 to use JDBC 2.0)

3. Added db2java.zip to catalina classpath by editing
   bin\setclasspath.bat

   EVIDENCE THIS MAKES THE DRIVER AVAILABLE TO CATALINA:
   When I omit this step and test the servlet, I get
   "javax.naming.NamingException:
   Exception creating DataSource: COM.ibm.db2.jdbc.app.DB2Driver"

   EVIDENCE THIS MAKES THE DRIVER AVAILABLE TO THE SERVLET:
   When I replace the DataSource code in the servlet with the
   following
   Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
 conn = java.sql.DriverManager.getConnection(
 "jdbc:db2:MYDB" , "USERID", "PASSWORD");
   it works with this step and doesn't work without it.

4. Updated appropriate conf\server.xml Context element to
   include

   <Resource name="jdbc/Alpha" auth="Container"
             type="javax.sql.DataSource"/>
   <ResourceParams name="jdbc/Alpha">
     <parameter>
       <name>driverClassName</name>
       <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
     </parameter>
     <parameter>
       <name>driverName</name>
       <value>jdbc:db2:MYDB</value>
     </parameter>
     <parameter>
       <name>user</name>
       <value>USERID</value>
     </parameter>
     <parameter>
       <name>password</name>
       <value>PASSWORD</value>
     </parameter>
   </ResourceParams>

   EVIDENCE THIS STEP IS WORKING:
   If I change the driverClassName to something bogus,
   I get an error relating to the bogus name.
   The driverName, "jdbc:db2:MYDB" does work in
 conn = java.sql.DriverManager.getConnection(
 "jdbc:db2:MYDB" , "USERID", "PASSWORD");

5. Updated appropriate web.xml to include

   <resource-ref>
     <res-ref-name>jdbc/Alpha</res-ref-name>
     <res-type>javax.sql.DataSource</res-type>
     <res-auth>Container</res-auth>
   </resource-ref>

   EVIDENCE THIS STEP IS WORKING:
   None. I get the same error with or without this element.

6. Visited servlet containing the following code:

   javax.sql.DataSource ds = (javax.sql.DataSource)
                             ctx.lookup("java:comp/env/jdbc/Alpha");
   pw.println("Get here");
   conn = ds.getConnection();
   pw.println("Don't get here");

7. Got

   Get here
   java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.java:243)
    at
tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:233)
    at
tyrex.jdbc.xa.EnabledDataSource.getConnection(EnabledDataSource.java:204)




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


Mime
View raw message