tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Isen,Ciji" <ci...@tamu.edu>
Subject Re: javax.servlet.ServletException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver
Date Mon, 02 Aug 2004 19:48:40 GMT
I wanted to tinker around hence i decide to just test using a jsp. The 
jsp code is pasted below.

<%@page contentType="text/html"%>

<%@ page import="java.util.*" %>

<html>
<head><title>JSP Page</title></head>
<body>

<%
            Connection conn = null;
            DBManager dbMan = null;
            Context ctx = new InitialContext();
            if(ctx == null )
                     throw new DBLibraryBaseException("Boom - No Context");
            Context envContext=(Context)ctx.lookup("java:comp/env");
            if(envContext == null )
                     throw new DBLibraryBaseException("Boom - 
java:comp/env - No Context");
                       
            DataSource myDataSource 
=(DataSource)envContext.lookup("jdbc/EconDollarsDB");             
            if (myDataSource != null) {
                   conn = myDataSource.getConnection();                   
            }else{
                            System.out.println("jdbc/EconDollarsDB' is 
an unknown DataSource");
                        }
            %>
</body>
</html>

Pasted below is the server.xml files part that i added.
 <Resource auth="Container" name="jdbc/EconDollarsDB" 
type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/EconDollarsDB">
      <parameter>
        <name>url</name>
        
<value>jdbc:mysql://localhost:3306/EconDollars?autoReconnect=true</value>
      </parameter>
      <parameter>
        <name>validationQuery</name>
        <value>select * from major</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>5</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>20</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>com.mysql.jdbc.Driver</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>10000</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>asdf</value>
      </parameter>
      <parameter>
        <name>factory</name>
        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
 <parameter>
        <name>password</name>
        <value>asdf</value>
      </parameter>
    </ResourceParams>

This is placed inside GlobalNamingResources.




Robert Bateman wrote:

>Please show us the source that is causing this error...
>
>
>On Monday 02 August 2004 02:44 pm, Isen,Ciji wrote:
>  
>
>>Hi,
>>I am using tomcat-5. I was trying out the connection pooling in it. I did
>>things as per their documentation but ended up with this error.
>>javax.servlet.ServletException: Cannot create JDBC driver of class '' for
>>connect URL 'null', cause: No suitable driver Does anyone have any idea
>>what and what this is. I am at loss why after finding the JDNI resource its
>>not able to pick up its parameters.
>>
>>regards,
>>Isen
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>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