When getObject returns a String or a byte[]
Posted by: ecka.kjellberg
Date: March 29, 2005 09:33AM

Hi
I got a question:
When does the getObject(n) on the ResultSet return a String respectively a byte[]?

The reason is that I got the following query:

SELECT DATE_FORMAT(atimestamp,'%Y-%m-%d %T') FROM atable;

And previously with MySQL 4.0.x I got back a String with a nicely formatted date like ‘2005-03-18 12:38:32’
But now I upgraded to MySQL 4.1 I get back a byte array that gets rendered as ‘[B@12558d6’ when I print it.

The resultset metadata on the field level looks a little bit different.

For MySQL 4.0.x
null . (null) . DATE_FORMAT(atimestamp,'%Y-%m-%d %T')(null), Mysql type: 253

For MySQL 4.1
. () . DATE_FORMAT(atimestamp,'%Y-%m-%d %T')(), Mysql type: 253

I could accept that I’m forced to use getString (that will give me a String with ‘2005-03-18 12:38:32’) and getObject when I’m interested in the actual bytes.

But my question remains...

Options: ReplyQuote


Subject
Written By
Posted
When getObject returns a String or a byte[]
March 29, 2005 09:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.