-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Tea Yu wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Tea Yu wrote:
Hi there!
Sorry, cause I didn't copy-n-paste those so there were typos, actually I created the table in console:
1) create table test (id INTEGER NOT NULL AUTO_INCREMENT, name
VARCHAR(255),
primary key (id));
2) here is the code segment
String insertStmt = "insert into test (name) values ('hi')"; String queryStmt = "select last_insert_id()";
try { stmt.executeUpdate(insertStmt); ResultSet rs = stmt.executeQuery(queryStmt); if(rs.next()) System.out.println("last insert id: " + rs.getInt(1)); } catch (SQLException e) { System.out.println(e); }
if a) I comment out the rs.getInt(1) line, no exception throws... else it throws something like java.sql.SQLException: Invalid value for getInt() - 't' b) if I use getString(1) instead, no exception throws... but it returns "t", "u" or something
3) I tried to insert records thru MySQLCC without errors.
More thoughts?
Regards Tea
The only thing I can guess (because my testsuite is really the same code, I just don't store the queries in variables), is that 'queryStmt' does not hold the query you think it does. Try inspecting it in a debugger or printing it out before you execute the query, to see what query you are really executing.
-mark
Not really, I substituted the queryStmt with the actual one but it gave the same result.
After some work:
select last_insert_id(); //getInt() should return 14 //but now it gives java.sql.SQLException: Invalid value for getInt() - 'qt' at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:1348)
where thisRow([0]) that ResultSet holds was = (49, 52)
I haven't looked deeper into ResultSet and StringUtils... Is this as expected?
My platform is WinME and my JRE is 1.4.1_01
thanks tea
The only way I can debug this is if you give me a repeatable test case. Since the test case I showed you does not repeat the bug, you will need to generate a standalone test case, with schema, data, and the java code that demonstrates the issue.
-Mark
- -- MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/
For technical support contracts, visit https://order.mysql.com/?ref=mmma
__ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mark Matthews <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java /_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA <___/ www.mysql.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.1.90 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE+YKwMtvXNTca6JD8RAgyPAKCFkk9RmrJ0y/P3qm/e7uXdYs1OhwCfZdHN V3Nhbe7Nv/YveuN84OEsZHQ= =EMfY -----END PGP SIGNATURE-----
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php