tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Briggs, Patrick" <pbri...@clinitech.net>
Subject RE: Tomcat -> MySQL = No suitable driver ERROR
Date Fri, 02 Jul 2004 16:36:11 GMT
David had me do this following proceedure and that seemed to work, but my
JSP does not return any data so far.  The database finally connected though.

When I view this JSP page, all it prints is:

${row.foo} ${row.bar}

instead of the data that should be contained inside those variables.

test.jsp:

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<sql:query var="rs" dataSource="jdbc/DBTest">
select * from testdata
</sql:query>

<html>
  <head>
    <title>DB Test</title>
  </head>
  <body>

  <h2>Results</h2>
  
<c:forEach var="row" items="${rs.rows}">
	<c:out value="${row.foo}"/>
	<c:out value="${row.bar}"/>
</c:forEach>

  </body>
</html>


>From David:

Here's first what should be in 
{TOMCAT_HOME}/conf/Catalina/localhost/DBTest.xml:

<Context path="/DBTest" docBase="DBTest"
        debug="0" privileged="false">

  <!-- Loggers, valves, other stuff here -->

  <Resource name="jdbc/DbTest"
            auth="container"
            type="javax.sql.DataSource"/>

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

    <!-- Customize with your database username -->
    <parameter>
      <name>username</name>
      <value>DBTestUser</value>
    </parameter>

    <!-- Customize with your database password here -->
    <parameter>
      <name>password</name>
      <value>*********</value>

    <parameter>
      <name>driverClassName</name>
      <value>com.mysql.jdbc.Driver</value>
    </parameter>

    <!-- Customize with your mysql url -->
    <parameter>
      <name>url</name>
      <value>jdbc:mysql://localhost:3306/DBTest?autoReconnect=true</value>
    </parameter>
  </ResourceParams>

</Context>

-----------------------------------------------------
Ok, now what should be in {TOMCAT_HOME}/webapps/DBTest/WEB-INF/web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
  <display-name>DbTest Application</display-name>

  <!-- All your servlet definitions, mappings, welcome file specs, 
taglibs, etc, ...
         are placed here. -->

  <!--+ resource-ref here to make the database pool available in this 
application
      +-->
  <resource-ref>
    <description>DBTest Database</description>
    <res-ref-name>jdbc/DbTest</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>

</web-app>

---------------------------------------------------------
This exact formula has worked for me in I can't even count how many apps 
I've setup.

--David

-----Original Message-----
From: Jan Behrens [mailto:jan@diekleinedomain.de]
Sent: Friday, July 02, 2004 1:50 AM
To: 'Tomcat Users List'
Subject: RE: Tomcat -> MySQL = No suitable driver ERROR


yes patrick,

i guess that is what david and i want so your dbtest works. allthough the
posted contents of web.xml lack a doctype or schema definition (see hassans
post). now, have you tried this?

cheers, jan

This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential or privileged
information.  Any unauthorized review, use, disclosure or distribution is
prohibited.  If you are not the intended recipient, please contact the
sender by reply e-mail and destroy the message.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message