Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

page displays integer database values wrong

843838Aug 27 2005 — edited Sep 12 2005
I'm just beginning to learn JSP and have come across a strange thing that I can't seem to find a simple solution to.

I work with Tomcat v5.5 and mySQL 4.

the JSP code is:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ 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/javatest">
select id, foo, bar, address from testdata
</sql:query>

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

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

  </body>
</html>
It's nothing much just get some data from mySQL and display it.

I'm expecting this:

Results
Id 1
Foo text
Bar 1
Address text2

But I'm getting this:

Results
Id 4294967297
Foo text
Bar 4294967297
Address text2

It's really confusing. The id and bar datatypes in mySQL are integers btw

Maybe it's a simple problem but could someone please help me sort this out?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2005
Added on Aug 27 2005
4 comments
94 views