I'm getting an error on the following query that I can't find how to fix, here's the query code:
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;
The error code:
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
EDIT: Changed the query to:
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;");
and i'm getting this error now:
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 runs the query without any problem.