Is your jdbc driver in jar file?

Regards,
 
 
PQ
 
"This Guy Thinks He Knows Everything"
"This Guy Thinks He Knows What He Is Doing"

-----Original Message-----
From: Uros Kotnik [mailto:[EMAIL PROTECTED]] 
Sent: February 6, 2003 11:24 AM
To: [EMAIL PROTECTED]
Subject: Cannot load JDBC driver class 'null' , again

Hi,

This question was probbably posted many times but I didn't found answer
and I really need it.

I'm using TC 4.1
DB : Hypersonic
HSQLDB.jar in \tomcat_home\common\lib

Server.xml
----------

<Context path="/DBTest" docBase="DBTest"
       debug="5" reloadable="true" crossContext="true">


  <Logger className="org.apache.catalina.logger.FileLogger"
             prefix="localhost_DBTest_log." suffix=".txt"
             timestamp="true"/>

  <Resource name="jdbc/TestDB"
               auth="Container"
               type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/TestDB">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>

    <!-- Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.
         -->
    <parameter>
      <name>maxActive</name>
      <value>100</value>
    </parameter>

    <!-- Maximum number of idle dB connections to retain in pool.
         Set to 0 for no limit.
         -->
    <parameter>
      <name>maxIdle</name>
      <value>30</value>
    </parameter>

    <!-- Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.
         -->
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>

    <!-- username and password for dB connections  -->
    <parameter>
     <name>username</name>
     <value>iuser</value>
    </parameter>
    <parameter>
     <name>password</name>
     <value>iuser</value>
    </parameter>

    <!-- Class name for JDBC driver -->
    <parameter>
       <name>driverClassName</name>
       <value>org.hsqldb.jdbcDriver</value>       
    </parameter>

    <parameter>
      <name>url</name>
      <value>jdbc:hsqldb:hsql://asterix</value>      
    </parameter>
  </ResourceParams>
</Context>


WEB.XML 
--------

  <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/TestDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

Servlet code
-------------

      Context initCtx = new InitialContext();
      Context envCtx = (Context) initCtx.lookup("java:comp/env");

      DataSource ds = (DataSource)envCtx.lookup("jdbc/TestDB");
      
      
      if (ds != null) {    
        Connection conn = ds.getConnection();

//"value" of DS is "org.apache.commons.dbcp.BasicDataSource@b6548"
//and here is exception  in "Connection conn = ds.getConnection();"

java.sql.SQLException: Cannot load JDBC driver class 'null'
        at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
rce.java:529)
        at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource
.java:312)


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

Reply via email to