JDBC执行创建数据库表的语句报错~急
蓝羽笙箫 2013-05-06 10:29:06 用JDBC执行创建数据库表并批量插入数据的sql语句,在mysql中语句执行正确,但用JDBC执行却报语法错误?什么原因?
String sql = "create table rtyrty18 ( dataId int auto_increment not null primary key, ww int(50),ee int(50));insert into rtyrty18 (ww,ee)values(1,1);insert into rtyrty18 (ww,ee)values(2,2);insert into rtyrty18 (ww,ee)values(3,3);insert into rtyrty18 (ww,ee)values(4,4);";
stmt = conn.createStatement();
stmt.executeUpdate(sql3);
错误是:
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 'insert into rtyrty18 (ww,ee)values(1,1);insert into rtyrty18 (ww,ee)values(2,2);' at line 1