2 messages in com.mysql.lists.javaRe: MYSQL DATE_FORMAT function proble...
FromSent OnAttachments
Gonzalez, Francisco22 Oct 2002 08:40 
Mark Matthews22 Oct 2002 09:38 
Subject:Re: MYSQL DATE_FORMAT function problem when used together with ORDER BY clause
From:Mark Matthews (ma@mysql.com)
Date:10/22/2002 09:38:07 AM
List:com.mysql.lists.java

Gonzalez, Francisco wrote:

Hi everyone,

I'm having problem in a SELECT statement when it's used with a DATE_FORMAT and/or TIME_FORMAT and the ORDER BY clause all together. And the problem is that the fields of types Date or Time that I format with the above functions are returned with weird chars. If I removed the ORDER BY clause from the SELECT statement the Date & Time fields are formatted properly. Or if I let the ORDER BY clause but removed the DATE_FORMAT function, for exmaple, it also works fine. ????

I've tried with the latest stable java JDBC driver (2.0.14) & with the beta release (3.0.1). This is being run in a Web application on Linux with Apache+Tomcat3

The fields with the problem are displayed like this "[B@309ee1".

Does anyone has any idea of what is going on here ?

Thanks in advance.

Certain functions in MySQL set the 'BINARY' flag for their results. You can't use getObject() on them and get a String, because the driver thinks they are BLOBs.

Use getString() when you want a value treated as a string.

-Mark