【发布时间】:2009-08-24 20:41:57
【问题描述】:
以下是我使用的代码:
byte[] bkey = key.getEncoded();
String query = "INSERT INTO keytable (name, key) VALUES (?,?)";
PreparedStatement pstmt = (PreparedStatement) connection.prepareStatement(query);
pstmt.setString(1, "test");
pstmt.setBytes(2, bkey);
pstmt.execute();
以下是我得到的错误:
com.mysql.jdbc.exceptions.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) VALUES ('test',_binary'?ʾ??s??u\'?}p?u')' at line 1
我有 MySQL 5.0.41 和 mysql-connector-java-5.1.7-bin.jar 作为 JDBC 库。
有人可以帮我吗?
提前致谢!
【问题讨论】:
-
您能否在您的表上执行“描述
”并向我们展示输出,以便我们知道您正在处理哪些列类型?