Bug #4880 | connectorJ ResultSetMetaData returns wrong length on varchar fields | ||
---|---|---|---|
Submitted: | 3 Aug 2004 20:18 | Modified: | 4 Aug 2004 2:38 |
Reporter: | Jim Mason | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S1 (Critical) |
Version: | 3.0.10 | OS: | Windows (Windows XP) |
Assigned to: | Mark Matthews | CPU Architecture: | Any |
[3 Aug 2004 20:18]
Jim Mason
[4 Aug 2004 1:49]
Matthew Lord
Dear User, Have you also experienced this when using 3.0.14,the latest production releast for connectorj?
[4 Aug 2004 2:16]
Matthew Lord
I was able to repeat this by using the attached Tester.java file. I was connecting from a RH 9 box using connector/j 3.0.14 and 3.1.3 to a windows 2k box running 4.0.20 and 4.1.3.
[4 Aug 2004 2:19]
Mark Matthews
Turns out this is defined in the _tutorial_ for JDBC, but not in the spec itself. Will be fixed for 3.0.15.
[4 Aug 2004 2:23]
Matthew Lord
Dear Sir, I apologize, I was calling getPrecision instead of getColumnDisplaySize(). getColumnDisplaySize() works correctly using 3.0.14 and 4.0.20. I do not see getLength() in ResultSetMetaData. Best Regards
[4 Aug 2004 2:35]
Mark Matthews
The JDBC compliance testsuite actually makes the following comment about RSMD.getPrecision(), which is why we are fixing this: * The getPrecision(int colindex) method returns an integer value * representing the number of decimal digits for number types,maximum * length in characters for character types,maximum length in bytes * for JDBC binary datatypes. * * (See Section 27.3 of JDBC 2.0 API Reference & Tutorial 2nd edition) The issue stems from the fact that this behavior is _not_ documented in the JDBC specification or the javadocs for java.sql.ResultSetMetaData, unfortunately.
[4 Aug 2004 2:38]
Mark Matthews
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html Additional info: This is now fixed in the source repository. A snapshot build of 3.0.15 with this fix will be available after 00:00 GMT on 04-Aug-04 at http://downloads.mysql.com/snapshots.php