"Executes the SQL statement in this PreparedStatement object, which may be any kind of SQL statement. : Syntax error or access violation message from server: "You have an error in your SQL syntax near ' select * from test where id = 2' at line 1"Īt .checkErrorPacket(MysqlIO.java:1997)Īt .sendCommand(MysqlIO.java:1167)Īt .sqlQueryDirect(MysqlIO.java:1278)Īt .execSQL(Connection.java:2247)Īt .executeQuery(PreparedStatement.java:1586)Īt MySQLPreparedStatementTester.(MySQLPreparedStatementTester.java:31)Īt MySQLPreparedStatementTester.main(MySQLPreparedStatementTester.java:51)Īt the Java API for PreparedStatement at method execute it says: I have not tried it my self but I have heard that this should work. With Sybase you should be able to do this but you should separate the 2 select-statement with a new-line. PreparedStatement preparedStatement = connection.prepareStatement("select * from test where id = 1 select * from test where id = 2 ") The problem seems to be at this line (given you have a database with a table called test): I have heard that this is possible with Sybase for eg. I think that this is possible with other databases. ![]() ![]() I would like to create a PreparedStatement that will return more then one ResultSet. ![]() I got a problem with mysql and PreparedStatement.
0 Comments
Leave a Reply. |