Bad Results!?
Hello,
Please help!!!!!!!!
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
------------- 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 ) );
}
}
Subject
Written By
Posted
Bad Results!?
June 24, 2005 12:51PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.