| Bug #62137 | getObject method can not get Correct rs | ||
|---|---|---|---|
| Submitted: | 10 Aug 2011 10:26 | Modified: | 10 Aug 2011 19:43 |
| Reporter: | zhu suo | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) |
| Version: | 5.1.17 | OS: | Linux (mysql 5.1.57) |
| Assigned to: | CPU Architecture: | Any | |
[10 Aug 2011 19:44]
Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php The driver does not automatically de-serialize objects. You have to use autoDeserialize=true to get behavior you expect.
[12 Aug 2011 21:34]
Mark Matthews
This isn't a bug about de-serialization. It *is* a bug about the types that mysqld returns to clients when mixed types are used. In this case, concat-ing a number and a string together yields a "binary string" in mysql speak, which is required to map to the SQL type VARBINARY, which according to the JDBC specification maps to the java class byte[]. Use a SQL cast() to get a string or number, or whatever you want, but concat-ing a number and a string is really un-defined without that.

Description: sql=" SELECT CONCAT(4,'6') AS h "; Statement st=con.createStatement(); ResultSet rs=st.executeQuery(sql); while(rs.next()){ System.out.println(rs.getObject(1).getClass().getName()); } execute the code and return "[B" How to repeat: execute the code