1. You can try giving a password to the database and setting the same in the
server.xml. See if this works.

Thanks
Tejas

-----Original Message-----
From: Roy Kiesler [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 03, 2006 10:41 PM
To: users@tomcat.apache.org
Subject: >>Tomcat 4<<: org.apache.commons.dbcp.SQLNestedException: Cannot
create JDBC driver of class '' for connect URL 'null'


I have been trying for 2 days now to setup a simple connection pool in
Tomcat 4.0.6 for a Hypersonic database with the ever-so-popular error in the
subject. I have read every possible Google post on the subject, but found
not solution for Tomcat 4, only 5.x.

Anyhow, here's the setup:


   1. hsqldb.jar is placed in %CATALINA_HOME%/common/lib
   2. %CATALINA_HOME%/server/conf/server.xml contains the following
   context definition:

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

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

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

      <ResourceParams name="jdbc/BookmartDB">
         <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>30</value>
         </parameter>

         <parameter>
            <name>maxWait</name>
            <value>10000</value>
         </parameter>

         <parameter>
            <name>username</name>
            <value>sa</value>
         </parameter>

         <parameter>
            <name>password</name>
            <value></value>
         </parameter>

         <parameter>
            <name>driverClassName</name>
            <value>org.hsqldb.jdbcDriver</value>
         </parameter>

         <parameter>
            <name>url</name>
            <value>jdbc:hsqldb:file:c:/bookmart</value>
         </parameter>

         <parameter>
            <name>removeAbandoned</name>
            <value>true</value>
         </parameter>

         <parameter>
            <name>removeAbandonedTimeout</name>
            <value>60</value>
         </parameter>

         <parameter>
            <name>logAbandoned</name>
            <value>true</value>
         </parameter>

      </ResourceParams>
   </Context>

   3. %CATALINA_HOME%/server/webapps/bookmartClient/WEB-INF/web.xml
   contains the following resource reference:

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

   4. My JSP code contains the following:

   Context initCtx = new InitialContext();
   Context envCtx = (Context) initCtx.lookup("java:comp/env");
   DataSource ds = (DataSource)envCtx.lookup("jdbc/BookmartDB");
   Connection conn = ds.getConnection();

This does not appear to be an issue with the driver, as the following code
works just fine:

Class.forName("org.hsqldb.jdbcDriver" );
Connection conn =
DriverManager.getConnection("jdbc:hsqldb:file:c:/bookmart",
"sa", "");
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select * from testdata");
if (rst.next())
{
   foo = rst.getString(2);
   bar = rst.getInt(3);
}

Hopefully this paints the picture clearly enough. Any insights?

Thanks,
--
Roy


http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
_____________________________________________________________________

This e-mail message may contain proprietary, confidential or legally
privileged information for the sole use of the person or entity to
whom this message was originally addressed. Any review, e-transmission
dissemination or other use of or taking of any action in reliance upon
this information by persons or entities other than the intended
recipient is prohibited. If you have received this e-mail in error
kindly delete  this e-mail from your records. If it appears that this
mail has been forwarded to you without proper authority, please notify
us immediately at [EMAIL PROTECTED] and delete this mail. 
_____________________________________________________________________

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to