用java向mysql中写入数据,报错,感觉我写的没问题,求大神帮忙!!
Connectionconn=DriverManager.getConnection(url,user,password);if(!conn.isClosed()){Sy...
Connection conn = DriverManager.getConnection(url, user, password);
if(!conn.isClosed()){
System.out.println("Success in getconnection!");
}
Statement stmt = conn.createStatement();
String sql = "INSERT INTO dblp_data1(title,pubtype,author,key,journal,page) VALUES('k','j','l','s','o','5')";
stmt.executeUpdate(sql);
stmt.close();
conn.close();
报错: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 'key,journal,page) VALUES('k','j','l','s','o','5')' at line 1 展开
if(!conn.isClosed()){
System.out.println("Success in getconnection!");
}
Statement stmt = conn.createStatement();
String sql = "INSERT INTO dblp_data1(title,pubtype,author,key,journal,page) VALUES('k','j','l','s','o','5')";
stmt.executeUpdate(sql);
stmt.close();
conn.close();
报错: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 'key,journal,page) VALUES('k','j','l','s','o','5')' at line 1 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询