-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Glyn,

On 12/12/11 8:07 AM, Glyn Thomas wrote:
> I am attempting to port a Tomcat/MySql application from OSX to
> Windows 7 (I previously ported it from Vista to OSX, so it
> shouldn't be as difficult as it sounds), and am having problems
> with back-compatibity on some queries.

SQL queries? That will have no bearing on Tomcat, the OS, etc. It has
everything to do with the database.

Why all the "porting"? Is there much of a difference? We just
brought-on another developer who uses a win32 development environment
and the only changes we had were settings for some base paths...

> The application works correctly on OSX, with Tomcat 5.5, JRE 1.5.0
> R12, Tomcat JDK 4 Compatibility Pack, J/Connector 5.1.14 and MySql
> 5.0.

You don't need the "JDK 4 Compatibility Pack" since you aren't using
JDK 4. Didn't you read the documentation for that?

> On Windows 7, my configuration is Tomcat 5.5.34, JRE 1.6.0 R26,
> J/Connector 5.1.18, MySql 5.5.  (I tried both with and without the
> JDK 4 Compatibility pack and it doesn't make a difference).

It shouldn't make a difference... in fact, I would expect things to
break when using the Compatibility Pack because it is effectively a
JAXB *downgrade* when using Java 1.5 or 1.6.

> The following test JSP shows the problem:
> 
> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql"; prefix="sql" %> 
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %> 
> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions";
> %> <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en"> 
> <head> <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8" /> <title>Test</title> </head> <body> 
> <h1>Results</h1> <sql:query var="rsImages"
> dataSource="jdbc/Images">

Oh, the problem is that you have a SQL query in a JSP? That's easy to
fix: issue the query from real Java code, then forward to the JSP to
display the results. :)

> SELECT 
> i.imageID,i.DateDay,i.DateMonth,i.DateYear,i.Location1,i.Location2,i.ScannedYN,c.description
>
> 
AS country,sd1.description AS Subject, sdt.fieldtypeid, sdt.lookuptablename
> FROM image_tbl i, lu_country_tbl c, xrf_image_subject_tbl si,
> subject_tbl s, subject_detail_tbl sd1, lu_subject_detail_type_tbl
> sdt WHERE (i.countryID=c.CountryID) AND (si.SubjectID=s.SubjectID)
> AND (si.ImageID=i.ImageID) AND (s.SubjectID=sd1.subjectID) AND 
> (sd1.subjectdetailtypeid=sdt.subjectdetailtypeid) AND 
> (sd1.subjectdetailtypeid IN (1,2,6,8,9,13)) and i.imageid=20002

Is the problem that you aren't using JOIN syntax? Because I'd use JOIN
syntax if I were you.

> </sql:query> ID: ${rsImages.rows[0].ImageID}<br>

Is the problem that you aren't properly escaping output thus making
yourself vulnerable to XSS attacks? That's something you ought to fix.

> ID: ${rsImages.rows[1].ImageID}<br>

Is the problem that you are running out of memory because your SQL
taglib reads all rows into a single, huge array? That can be solved in
many different ways.

> When running this page, ID, Location and Description are all
> returned with values.  However, country and Subject are not
> returned at all.  You will note that country and Subject are both
> aliased in the query.  Description is not a directly requested in
> the query, but is returning the contents of sd1.description.

There was a bug a while back in Connector/J with incorrect column
alias semantics. You might want to check the changelog for Connector/J.

Check out my AdHocQuery.jsp to see what's coming back from your database:
http://christopherschultz.net/projects/java/

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7qb80ACgkQ9CaO5/Lv0PDSEACfXWFxy1QHZOGoUGMmEWgwOKT7
63QAniJccc3Wlo5+32Qm6s6YdDhMaFR0
=TeTN
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to