MySQL Forums
Forum List  »  Connector/JDBC and Java

Can someone tell me what's wrong with my sql statement ?
Posted by: Karen Goh
Date: July 21, 2017 07:38AM

I got this error which I have been trying the whole day long but I still can't resolve it. Hope to get some help here.

The error is
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES92' at line 1

And here's my code :

connection.commit();
ResultSet tableKeys = ps.getGeneratedKeys();

int generatedId = 0;
while(tableKeys.next())
generatedId = tableKeys.getInt(1);
stmt3 = (Statement) connection.createStatement();
String sql3 =
"INSERT INTO project.tutor_subject (tutor_id)"
+ "VALUES"
+ generatedId;

Options: ReplyQuote


Subject
Written By
Posted
Can someone tell me what's wrong with my sql statement ?
July 21, 2017 07:38AM


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.