tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Williams, Mark L CIV NSWC-PC" <mark.l.willi...@navy.mil>
Subject JSTL / MYSQL JDBC / TOMCAT 5
Date Fri, 20 Aug 2004 19:29:42 GMT
Folks:

I've run through the instructions at
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples
-howto.html for MySQL and have thrashed through the process to the point
that I'm convinced that I have a database connection (I can get lots of
errors from MySQL itself and I've put a sql:update command in that
inserted a row in the test database). I've hunted all over and adapted a
little test program for Oracle and have searched the TOMCAT archives.
Sure, I may have missed something, but if I use the test program to
query the database, the variable values aren't returned. For example,
using this exact code from the site above:

	<%@ 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/TestDB">
	select id, foo, bar from testdata
	</sql:query>

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

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

	  </body>
	</html>

gives me:

Results

Foo ${row.foo}
Bar ${row.bar}

Verbatim. And that's with two rows in the database now. Again, if I
change the function to a sql:update and poke values into the database,
they go in ok. The TOMCAT administrator shows the appropriate data
source for the database. The Oracle example attempts to get the column
names from a query and use those to label a "SELECT *" kind of
retrieval.

Any suggestions on what to try next (other than give up and go to
regular servlets) would be greatly appreciated.

VR/
Mark L. Williams
Computer Scientist
Naval Surface Warfare Center Panama City




Mime
View raw message