I belive that PreparedStatements can return multiple ResultSet since they got the method:
...that I belive jumps to the next ResultSet.
But when I try to create a PreparedStatement with a question that should give back more then one ResultSet like and rub with my mysql:
connection.prepareStatement("SELECT * FROM tbl_test; SELECT * FROM tbl_users;");
I just get a exception like there is something wrong with the SQL-statement.
Has any one tried this?
I also have an other problem, that may depend on the same as above, when I create PreparedStatement with more than one questions like above but which only should give back one ResultSet:
connection.prepareStatement("INSERT INTO tbl_test (text1, text2) VALUES(?, ?); SELECT LAST_INSERT_ID() FROM tbl_test;");
The exception is:
java.sql.SQLException: Syntax error or access violation: You have an error in your SQL syntax near';SELECT LAST_INSERT_ID() FROM tbl_test; ' at line 1
So perhaps it something wrong how I create the SQL-statements but the strange thing is that it works fine from the commandprompt for mysql. Like if I just type:
INSERT INTO tbl_test (text1, text2) VALUES(?, ?); SELECT LAST_INSERT_ID() FROM tbl_test;
...that works fine in.
So if any one got a solution for this it would be great!
BTW 30 points is all I got, sorry!