String sql = "CREATE DATABASE IF NOT EXISTS archer "
+ "DEFAULT CHARSET latin1;"
+ "USE archer;"
+ "CREATE TABLE IF NOT EXISTS directories ("
+ "`ID` int(10) unsigned not null auto_increment,"
+ "`DIRECTORY_NAME` varchar(255) not null,"
+ "`DATE` bigint(64) not null,"
+ "`SIZE` bigint(64) not null,`"
+ "FILES_NUMBER` int(11) not null,"
+ "`SUBDIRECTORIES_NUMBER` int(11) not null,"
+ "PRIMARY KEY (`ID`)"
+ ") ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=20492;"
+ "TRUNCATE TABLE `directories`;"
+"CREATE TABLE IF NOT EXISTS `extensions` ("
+ "`ID` int(10) unsigned not null auto_increment,"
+ "`EXTENSION` varchar(10) not null,`TYPE` varchar(15) not null,"
+ "PRIMARY KEY (`ID`),"
+ "UNIQUE KEY (`EXTENSION`)"
+ ") ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;"
+ "TRUNCATE TABLE `extensions`;"
+ "CREATE TABLE IF NOT EXISTS `files` ("
+ "`ID` int(10) unsigned not null auto_increment,"
+ "`FILE_NAME` varchar(100) not null,"
+ "`SIZE` bigint(64) not null,"
+ "`DATE` bigint(64) not null,"
+ "`EXTENSION` varchar(20) not null,"
+ "`DIRECTORY` varchar(255) not null,"
+ "PRIMARY KEY (`ID`)"
+ ") ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=107764;"
+ "TRUNCATE TABLE `files`;";
PreparedStatement stmt = new ConnectionFactory().getConnection().prepareStatement(sql);
stmt.execute();
stmt.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 'USE archer;CREATE TABLE IF NOT EXISTS directories (`ID` int(10) unsigned not nul' at line 1
Alguém sabe me dizer o problema que está a ocorrer?
Tnx Men!