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