import java.sql.SQLException; public class Bug11940 extends testsuite.BaseTestCase { public Bug11940(String name) { super(name); } public void setUp() throws Exception { super.setUp(); dropTable("test_table"); createTable("test_table","(`int_field` int(6) unsigned NOT NULL default '0') ENGINE=InnoDB"); stmt.executeUpdate("insert into test_table values (123456)"); } public void testUnsignedInt() throws SQLException { rs = stmt.executeQuery("SELECT `int_field` FROM `test_table` WHERE `int_field` = 123456"); assertTrue("retrieved 0 recurds but must retrive 1 rec", rs.next()); String i = rs.getObject(1).toString(); /* rs.getObject(1) = 123456 (can be other getXxx() int methods) */ System.out.println(i); assertTrue("We must fetch 123456 but fetched "+i,i.equals("123456")); pstmt = conn.prepareStatement("SELECT `int_field` FROM `test_table` WHERE `int_field` = ?"); pstmt.setInt(1,123456); rs = pstmt.executeQuery(); assertTrue("retieved 0 records (must retrieve 1 record)",rs.next()); String i1 = rs.getObject(1).toString(); System.out.println(i1); assertTrue("We must fetch 123456 but fetched "+i1,i.equals(i1)); } public static void main(String args[]) throws Exception { junit.textui.TestRunner.run(Bug11940.class); } }