tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gilad.b...@bcn.concatel.com
Subject Re: Cannot load JDBC Driver class com.ibm.db2.jdbc.app.DB2Driver
Date Thu, 03 Apr 2003 09:37:49 GMT

try using the com.ibm.db2.jdbc.net.DB2Driver . (instead of the
...app.DB2Driver.)
it's a thin client that doesn't require finding libraries locally...
url would be something like:
jdbc:db2//localhost/db_name

or if you use a non-standard port and use an ip address instead of a
hostname:
jdbc:db2//192.168.1.123:9993/db_name

/gilad


                                    
 Gilad Buzi                         
 R&D Engineer · CONCATEL            
                                    
                                    
 gilad.buzi@bcn.concatel.com        
 c/Sardenya, 229-237 Atic. 2a ·     
 08013 Barcelona Spain              
 tel. +34.93.244.88.77 · fax        
 +34.93.244.88.78                   
                                    
          www.concatel.com          
                                    





                                                                                         
                                      
                    Stephen                                                              
                                      
                    Peterson             Para:   tomcat-user@jakarta.apache.org          
                                      
                    <cspeter8@yah        cc:                                          
                                         
                    oo.com>              Asunto:      Cannot load JDBC Driver class com.ibm.db2.jdbc.app.DB2Driver
             
                                                                                         
                                      
                    02/04/2003                                                           
                                      
                    12:28                                                                
                                      
                    Por favor,                                                           
                                      
                    responda a                                                           
                                      
                    "Tomcat Users                                                        
                                      
                    List"                                                                
                                      
                                                                                         
                                      
                                                                                         
                                      



Hello,

I'm getting this java.sql.SQLException when trying to open a
connection
on my datasource.  The WebSphere Test Environment datasource
opens connections fine,
but not Tomcat/4.1.24.  Other details, using DB2 Personal
Edition version 7.2,
on Windows 2000 Professional.

I copied C:\sqllib\db2java.zip to $CATALINA_HOME/common/lib
directory, renaming
to db2java.jar.

I verified that the com.ibm.db2.jdbc.app.DB2Driver class was
actually in the jar file.

In the server.xml listing below I added parms for username
and password since I always see them in other postings, although
I have always spcified the username/password in the
getConnection
method call, successfully in websphere.
==============
server.xml:

<DefaultContext>
  <Resource name="jdbc/GuppyDB" auth="Container"
            type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/GuppyDB">
    <parameter>
      <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
    </parameter>
    <parameter>
      <name>url</name>
      <value>jdbc:db2:gupt1b</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>password</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>user1</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>8</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>4</value>
    </parameter>
  </ResourceParams>
</DefaultContext>
================
in web.xml:
<resource-ref>
  <description>
    Resource reference to a factory for java.sql.Connection
    instances that may be used for talking to a particular
    database that is configured in the server.xml file.
  </description>
  <res-ref-name>
    jdbc/GuppyDB
  </res-ref-name>
  <res-type>
    javax.sql.DataSource
  </res-type>
  <res-auth>
    Container
  </res-auth>
</resource-ref>
===================
in my servlet:

import java.sql.Connection;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) envCtx.lookup("jdbc/GuppyDB");
Connection conn = ds.getConnection("user1", "passwd");
conn.close();

The following is thrown in the ds.getConnection method:

java.sql.SQLException: Cannot load JDBC driver class
'com.ibm.db2.jdbc.app.DB2Driver'

Now I did see Fabio Mengue's posting from Feb 20 in a response
to someone asking a similar question.  I compared his config
with mine, added at the top of <TOMCAT>/bin/setclasspath.sh
the line
set JAVA_OPTS="-Djava.library.path=C:/Program
Files/sqllib/java/"

and started tomcat with the startup.sh instead of the services
start in the Computer Management dialog.

The other item:
----------------
Add the following line
Create <TOMCAT>/bin/setenv.sh, as a copy (or a link) of file
<DB2>/sqllib/db2profile.
----------------
I am at a loss, since I cannot find a db2profile file on my PC,
although I do have the DB2 server software installed as well as
the
DB2 client software.

If anyone has any helpful suggestions that would be welcome.

Thanks
Stephen Peterson

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

---------------------------------------------------------------------
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


Mime
View raw message