Bug #2623 ClassCastException when calling rs.absolute(int) if using PreparedStatement
Submitted: 3 Feb 2004 3:54 Modified: 9 Feb 2004 10:11
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.1.1 OS:Any (Any)
Assigned to: Mark Matthews CPU Architecture:Any

[3 Feb 2004 3:54] [ name withheld ]
Description:
java.lang.ClassCastException
	at com.mysql.jdbc.ResultSet.absolute(ResultSet.java:2137)

This error doesn't occurs when using Statement. It only occurs when using PreparedStatement.

Environment:
- MySQL server 4.1.1-alpha on Linux. (Mandrake 8.1)
- mysql-connector-java-3.1-nightly-20040203-bin.jar (on Win98) 
- JSDK 1.4.2 b-28 (on Win98)
- Apache Tomcat 4.1.29 (on Win98)

As far as I remember, it worked with MySQL-4.1.0 and mysql-connector-java-3.1.0-alpha-bin.jar.
I tried to downgrade to mcj3.1.0.alpha, but it seems to be incompatible with MySQL 4.1.1, so I can't test.

How to repeat:
PreparedStatement pstmt=conn.prepareStatement("select * from test");
ResultSet rs=pstmt.executeQuery();
rs.absolute(11); //the error occurs here (the test table has about 30 rows)
while (rs.next())
{
  int val= rs.getInt(1);
  out.println(val); 
}
rs.close();
pstmt.close();
[9 Feb 2004 10:11] 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