Good to hear that it is finally working. I am sorry, but I have never used
any sql tag-lib so I can't really help you with this problem. I would
suggest though, to google for a simple example - if that doesn't help open a
new thread here in the list and ask specifically for help with your new
problem. I am sure that someone will know...

Jan

-----Original Message-----
From: Briggs, Patrick [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 02, 2004 6:36 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat -> MySQL = No suitable driver ERROR


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:[EMAIL PROTECTED]
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.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to