I am getting the above mentioned exception while executing the SQL query in Java.
statement2.executeUpdate("INSERT INTO visit_header"
+ "VALUES('"+visitnumber+"','"+date+"','"+cookie+"','"+ip+"')");
I want to know where it is going wrong.
您忘记在 visit_header 和值之间放置空格:
statement2.executeUpdate("INSERT INTO visit_header" + " VALUES ('"+visitnumber+"','"+date+"','"+cookie+"','"+ip+"')");
根据最初的外观,您的 sql 查询有问题:
statement2.executeUpdate("INSERT INTO visit_header" + "VALUES
应该
statement2.executeUpdate("INSERT INTO visit_header " + "VALUES //Note space after header
visit_header 和 VALUES 之间没有空格,所以您的查询是这样的:
INSERT INTO visit_headerVALUES
这是错误的。