tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Help!!!Problem in creating connection from connection Pool in tomcat 4.1.24
Date Wed, 14 May 2003 14:45:24 GMT

Well, I don't know if this is your problem, but you can remove the 
classes111.jar.  All you need is classes12.jar in common/lib

And the following works for me...

                 try {
                     Context ctx = new InitialContext();
                     ds = 
(DataSource)ctx.lookup("java:comp/env/jdbc/myoracle");
                     if (ds == null) throw new SQLException("No DataSource 
available for Connection");
                     if (logger.isDebugEnabled()) logger.debug("The 
Datasource is: " + ds);
                 }
                 catch (NamingException ne) {
                     throw new SQLException("JNDI Lookup Failed: " + 
ne.getMessage());
                 }


Also double check that your connectionurl parameter is proper for your 
database.

Jake

At 04:42 PM 5/14/2003 +0530, you wrote:

>hi,
>
>I AM POSTING IT AGAIN PLEASE SOMEONE REPLY.
>
>I am using Oracle database on Win2000 with tomcat 4.1.24
>
>I read how-to-create database connection from connection pool and used it
>like that.
>
>I have copied classes111.zip and classes12.zip in common/lib folder...
>and i have renamed it to classes111.jar and classes12.jar
>
>my code to access it
>
>Context initContext = new InitialContext();
>Context envContext  = (Context)initContext.lookup("java:/comp/env");
>DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
>System.out.println("ds11111111 : "+ds);
>Connection conn = ds.getConnection();
>
>This is the error i am getting
>****************************************************************************
>
>ds11111111 : org.apache.commons.dbcp.BasicDataSource@3e0aba
>Error ! 'Cannot load JDBC driver class 'null'
>java.sql.SQLException: Cannot load JDBC driver class 'null'
>         at
>org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSou
>rce.java:529)
>****************************************************************************
>
>
>Please tell me what may be the problem?????
>
>in server.xml i have
>
><Resource name="jdbc/myoracle" auth="Container"
>                           type="javax.sql.DataSource"/>
>
><ResourceParams name="jdbc/myoracle">
>                 <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:@172.16.0.100:1521:oracle</value>
>                 </parameter>
>                 <parameter>
>                 <name>username</name>
>                 <value>shyam</value>
>                 </parameter>
>                 <parameter>
>                 <name>password</name>
>                 <value>shyam</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>
>****************************************************************************
>
>in application web.xml
>
><resource-ref>
>                 <description>Oracle Datasource example</description>
>                 <res-ref-name>jdbc/myoracle</res-ref-name>
>                 <res-type>javax.sql.DataSource</res-type>
>                 <res-auth>Container</res-auth>
>         </resource-ref>
>
>****************************************************************************
>
>
>
>---------------------------------------------------------------------
>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
>
>
>---------------------------------------------------------------------
>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
>
>
>---------------------------------------------------------------------
>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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message