Bug #27317 Exception message has a bad inequality
Submitted: 21 Mar 2007 4:27 Modified: 20 May 2007 5:42
Reporter: S Irvine Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.23.58 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[21 Mar 2007 4:27] S Irvine
Description:
Exception message generated by jdbc contains a stupid inequality

Exception in thread "main" java.sql.SQLException: Column Index out of range, 0 > 2.

That is, the message reports that the cause of the problem is that 0 > 2.
This is nonsensical.  The problem was that I accidently tried to retrieve
columns 0 and 1, when I should have retrieved 1 and 2.

The exception message should be something like,  Column Index of of
range 0 < 1.

Extended trace:

Exception in thread "main" java.sql.SQLException: Column Index out of range, 0 > 2. 
        at com.mysql.jdbc.ResultSet.checkColumnBounds(ResultSet.java:4456)
        at com.mysql.jdbc.ResultSet.getStringInternal(ResultSet.java:2082)
        at com.mysql.jdbc.ResultSet.getString(ResultSet.java:2076)
        at org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:174)

How to repeat:
Ask for column 0, as in:

ResultSet rs = s.executeQuery(query);
rs.next();
rs.getString(1)

Suggested fix:
Change exception message.
[21 Mar 2007 5:09] Valeriy Kravchuk
Thank you for a problem report. What version of Connector?J do you use?
[21 Mar 2007 20:54] S Irvine
The exact version of Connector?J is

mysql-connector-java-3.1.6.tar.gz
[22 Mar 2007 14:05] Mark Matthews
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/22538
[13 Apr 2007 8:32] MC Brown
A note has been added to the 5.0.6 changelog.
[20 May 2007 5:42] MC Brown
A note has been added to the 5.0.6 changelog.