tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey.Ro...@ukrpost.net
Subject DBCP error
Date Mon, 03 Nov 2003 13:11:38 GMT

Help me, please, to set Tomcat DBCP !

Configuration: Tomcat 4.1.27, Oracle 9i.

1. Struts DBCP works well.

2. Files classes12.jar, commons-collections, -pool, -dbcp
   has been removed from WEB-INF/lib into commons\lib .
3. web.xml
        <resource-ref>
            <description>Database Reference</description>
            <res-ref-name>jdbc/BANK</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
        <env-entry>
                <env-entry-name>jndi-datasource-name</env-entry-name>
                <env-entry-value>jdbc/BANK</env-entry-value>
                <env-entry-type>java.lang.String</env-entry-type>
        </env-entry>

4.  GetConnection:

       Error in line conn=ds.getConnection() .
       printStackTrace() -> cannot load JDBC driver class 'null' .

       Context ic = new InitialContext() ;
       Context env = (Context) ic.lookup("java:/comp/env") ; 
                
       DataSource ds = (DataSource) env.lookup("jdbc/BANK") ; 
           
       try {
           conn=ds.getConnection() ;   <<<<<<<<<<   ERROR .
           System.out.println( " Connection " ) ;
       }
       catch ( java.sql.SQLException sqle )
       {
          System.out.println( " ds.Connection exception " ) ;
          sqle.printStackTrace() ;
       }

5.     Server.xml

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

            <ResourceParams name="jdbc/BANK">
              <parameter>
                <name>factory</name>
                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
              </parameter>
              <parameter>
                <name>driverClassName</name>
                <value>oracle.jdbc.driver.OracleDriver</value>
              </parameter>
              <parameter>
                <name>url</name>
                <value>jdbc:oracle:thin:@localhost:1521:XXX</value>
              </parameter>
              <parameter>
                <name>username</name>
                <value>uname</value>
              </parameter>
              <parameter>
                <name>password</name>
                <value>pwd</value>
              </parameter>
              <parameter>
                <name>maxActive</name>
                <value>20</value>
              </parameter>
              <parameter>
                <name>maxIdle</name>
                <value>10</value>
              </parameter>
              <parameter>
                <name>maxWait</name>
                <value>-1</value>
              </parameter>
         </ResourceParams>




Thank in advance !
 Andrey                          mailto:Andrey.Rogov@ukrpost.net


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