Bug #11552 Bad Results
Submitted: 24 Jun 2005 18:53 Modified: 24 Jun 2005 19:59
Reporter: Eric Kamradt Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:jdbc 3.1.10 OS:Windows (Windows 2000)
Assigned to: Mark Matthews CPU Architecture:Any

[24 Jun 2005 18:53] Eric Kamradt
Description:
Hello,

Please help!!!!!!!!

MySql version : 4.1.12a

When switching from the mysql-connector-java-3.1.7-bin.jar driver to the mysql-connector-java-3.1.10-bin.jar driver - I get different results.

I don't like the results I'm getting with 3.1.10 - I think it is wrong.  (Also 3.1.8 worked fine for me)

3.1.7 - Output from java program below
-----------------------------------------------
User_Id = 2
User_Id = 2
User_Id = 2

3.1.10 - Output from java program below
-----------------------------------------------
User_Id = 2
User_Id = 4294967298
User_Id = 4294967298

How to repeat:
------------- mySql table script

drop table jatestuser;
create table jatestuser
(
  user_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
  user_name VARCHAR(128) NULL,
  PRIMARY KEY(user_id)
)
TYPE=InnoDB;

insert into jatestuser values ( 1, "One" );
insert into jatestuser values ( 2, "Two" );
insert into jatestuser values ( 3, "Three" );
commit;

select * from jatestuser;

------------------- Java test program

import java.sql.*;
public class Test_Database
{
    public static void main (String args [])
        throws Exception
    {

        Class.forName("com.mysql.jdbc.Driver");             // Step 1: Load the JDBC driver.
        String url = "jdbc:mysql://localhost:3306/ie";      // Step 2: Establish the connection to the database.

        Connection conn = DriverManager.getConnection ( url, "", "" );

        PreparedStatement v_Statement =
            conn.prepareStatement ( "SELECT * FROM jatestuser WHERE user_name = ?" );

        v_Statement.setString ( 1, "Two" ) ;

        ResultSet v_Result_Set = v_Statement.executeQuery ();
        v_Result_Set.first ();

        System.out.println ( "User_Id = " + v_Result_Set.getString ( 1 ) );
        System.out.println ( "User_Id = " + v_Result_Set.getObject ( 1 ) );
        System.out.println ( "User_Id = " + v_Result_Set.getLong ( 1 ) );
    }
}

Suggested fix:
I don't know
[24 Jun 2005 19:59] Mark Matthews
Thank you for your bug report. This is fixed for 3.1.11, and will be available in the nightly snapshot build after 00:00 GMT June 25th.
[24 Jun 2005 20:00] Mark Matthews
(snapshot builds are available at http://downloads.mysql.com/snapshots.php#connector-j)