Problem with Displaying Result of Join in JSP
"Glyn Thomas" <[email protected]> Sat, 12 Jul 2008 17:13:13 -0400
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Message-ID | <000001c8e464$18bed040$4a3c70c0$@net> |
I am in the process of converting a Web front end for a MySQL database from
Windows XP to Windows Vista.
The XP version used MySQL Version 5.0.22, Tomcat 5.5.20, JRE 1.5.0 release
12 with Tomcat JDK 4 Compatibility Pack, and J/Connector 5.0.6.
The Vista version is using MySQL Version 5.0.51a, Tomcat 5.5.26, JRE
1.6.0_05, and J/Connector 5.1.6.
I am unable to display any parts of a result set that are retrieved from
JOINed tables in the Vista version - this works fine in the XP version. I
already tried converting the queries to use JOIN syntax instead of WHERE
syntax, without improvement.
For example, this query works correctly in the MySQL command line:
SELECT
i.ImageID,i.DateDay,i.DateMonth,i.DateYear,i.Location1,i.Location2,i.Scanned
YN,i.MediaID,c.Description as 'Country', s.SubjectID, s.SubjectTypeID,
i.CountryID,i.PhotographerID, i.VolumeNumber FROM image_tbl i JOIN
lu_country_tbl c ON (i.countryid=c.countryid) JOIN xrf_image_subject_tbl si
ON (si.Imageid=i.imageid) JOIN subject_tbl s ON (si.Subjectid=s.subjectid)
WHERE (i.imageid=1234);
In JSP, I retrieve the results of this query into an rsImages variable, and
then iterate through the rows using:
<c:forEach var="row" items="${rsImage.rows}">
Rows that retrieve directly from the image_tbl work correctly e.g.
${row.ImageID} will display the image ID.
However, elements from the joined tables, such as ${row.Country} and
${row.SubjectID} don't get retrieved.
Any hints on how to resolve this problem would be appreciated.
Thanks,
Glyn Thomas