我得到以下查询,我无法找到如何解决错误不能正常工作,这里的查询代码:SQL“CREATE TABLE”查询在java中
CREATE TABLE IF NOT EXISTS `minecraftitems.blocks` (`player` varchar(16) NOT NULL, `itemid` text NOT NULL, `action` text NOT NULL,`time` big(20) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1;
错误代码:
10:48:05 [GRAVE] 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 'CREATE TABLE IF NOT EXISTS `blocks` (`player` varchar(16) NOT NULL, `itemid` tex' at line 1
编辑: 改变了查询:
PreparedStatement sql = con.prepareStatement(
"SELECT '" + db + "'; CREATE TABLE IF NOT EXISTS `minecraftitems.blocks` (\r\n" +
" `player` varchar(16) NOT NULL,\r\n" +
" `itemid` text NOT NULL,\r\n" +
" `action` text NOT NULL,\r\n" +
" `time` bigint(20) NOT NULL\r\n" +
" ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
,现在我得到这个错误:
11:07:22 [GRAVE] 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 'CREATE TABLE IF NOT EXISTS `minecraftitems.blocks` (`player` varchar(16) N' at line 1
PhpMyAdmin无任何问题地运行查询。
这个问题似乎是题外话,因为它是一个“查找我的错别字问题” – bummi 2014-11-01 18:51:41