Okay, I looked at the JDBC driver's code.  It returns a byte[] in cases
where the underlying object is java.sql.Types.LONGVARBINARY.  For some
reason, then, it looks like MySQL is returning a LONGVARBINARY column for
the one you're labeling "Date".  This might be because the DATE_FORMAT
function results in a column of MySQL's "TEXT" type, which may be
translated to JDBC's LONGVARBINARY.

Here's what I would suggest:  avoid formatting the date in the query.  
That is, let the query ultimately return an actual java.util.Date if the
JDBC driver supports it, or a plain string (parsable with <fmt:parseDate>)
if it doesn't.

You could try calling getColumnType() to confirm what I've guessed here.  
Either way, though, I don't think there's anything we can do in the JSTL
RI to address this MySQL/JDBC issue.  Alternatively, the JSTL spec could
be modified to support byte[] more cleanly:  for instance, the JSTL EL
could print out a byte[] by converting it to a String using the default
character encoding.  This is somewhat ugly, but it might fit nicely with
our other type conversions.  I'll raise it to the expert group.

Thanks again for the report,

-- 
Shawn Bayern
Author, "JSP Standard Tag Library"  http://www.jstlbook.com
(coming this summer from Manning Publications)

On Mon, 1 Apr 2002, Zvolensky, Thomas J {PDBI~Nutley} wrote:

> <c:out value="${row.Date.class}" /> produced a blank for the date column.
> 
> My JDBC driver is mm.mysql-2.0.11-bin.jar which can be downloaded from
> http://prdownloads.sourceforge.net/mmmysql/mm.mysql-2.0.11-you-must-unjar-me
> .jar
> 
> Regards.
> 
> -----Original Message-----
> From: Shawn Bayern [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 01, 2002 12:09 PM
> To: Tag Libraries Users List
> Subject: Re: JSTL Date Format Question
> 
> 
> A variable that prints a string starting with "[B" is likely a primitive
> byte array (byte[]).  This means that the MYSQL JDBC driver you're using
> is probably returning a byte[] for the column aliased "Date" when it's
> retrieved using ResultSet.getObject().  You could add
> 
>   <c:out value="${row.Date.class}" />
> 
> to the loop just to be sure.
> 
> I'm not sure this is anything the JSTL RI can address.  If DBTags works
> with exactly the same JDBC driver, it might be that the critical
> difference is that the driver returns a usable string when its ResultSet's
> getString() method is called; I believe DBTags uses getString() where we
> use getObject().
> 
> If you let me know specifically what MySQL JDBC driver you're using (a
> pointer to its URL would be all I need), I can attempt to trace the
> problem further and perhaps resolve the issue with the driver's
> maintainers.  (Or, of course, my own replication of the problem could show
> that it's really our bug.)
> 
> Thanks for the report,


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

Reply via email to