<分区>
我有一个脚本需要在一个语句中插入多个东西,比如
sql = "INSERT INTO `table` (something, something) VALUES (smth,smth); INSERT INTO `table` (something, something) VALUES (smth,smth)";
Statement stmt = connection_db.createStatement();
boolean update = stmt.execute(sql);
长sql是根据条件拼接的,需要这么长。在phpmyadmin中使用这种sql语句是有效的并且插入它没有问题,但是JAVA吐出错误。
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO `
我可以做些什么来插入这种 sql,还是我应该重新编写我的代码以启动多次以获得相同的结果?