I'm running Tomcat 5.5 and trying to do a very simple jdbc connection a 
single table. I have set up tomcat to run on port 8070 and the mysql database 
on the default 3306 port. It's the connection statement in the jsp that is 
blowing up - If I take that out, it works fine.
   
  I'm getting page not found or 
...."Cannot create JDBC driver of class '' for connect URL 'null' ".


> Steps I have done
>
> 1) Created a DB called everycitizen and a table called test with a
> column called pk. Created user everyuser w/ a password and granted Select 
> privileges to that user.
> 2) Copied the mysql-connector-java-3.1.12-bin.jar into
> $CATALINA_HOME/common/lib.
> 3)Added the following to the $CATALINA_HOME/conf/server.xml 
  
> > javax.sql.Datasource" name="jdbc/WroxTC5" 
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/everycitizen" username="everyuser" 
> password="%%%%%" maxActive="20" maxIdle="30000"
> maxWait="100"/>
> 
> 4) Added the following to the
> $CATALINA_HOME/webapps/jsp-examples/WEB-INF web.xml file at the bottom
> just before the entry after the last env-entry.
>
> 
> jdbc/WroxTC5
> javax.sql.DataSource
> Container
> 
>
> 5) Added the JDBCTest.jsp file and the errorpg.jsp file to
> $CATALINA_HOME/webapps/jsp-examples/wroxjdbc directory. I created the
> wroxjdbc folder. The JDBC Test is:
>
> 
> 
> > import="java.sql.*,
> javax.sql.*,
> java.io.*,
> javax.naming.InitialContext,
> javax.naming.Context" %>
> 
> JDBC JNDI Resource Test
> > InitialContext initCtx = new InitialContext();
> DataSource ds =
> (DataSource)initCtx.lookup("java:comp/env/jdbc/WroxTC5");
> Connection conn = ds.getConnection();
> Statement stmt = conn.createStatement();
> ResultSet rset = stmt.executeQuery("select * from test;");
> %>
> 
> 
> XXXX
> 
> > while (rset.next())
> {
> %>
> 
> > rset.close();
> stmt.close();
> conn.close();
> initCtx.close();
> %>

Reply via email to