-- MySQL dump 10.13 Distrib 5.7.15, for Linux (x86_64)
--
-- Host: localhost Database: messagehub
-- ------------------------------------------------------
-- Server version 5.7.15
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
....
当我使用脚本运行器时,错误是:
Cause: 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 'SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_CO' at line 8
我的java代码如下:
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/?useSSL=false", "root", "sa");
Reader reader = Resources.getResourceAsReader(path);
ScriptRunner runner = new ScriptRunner(con);
runner.setAutoCommit(true);
runner.setSendFullScript(true);
runner.runScript(reader);
reader.close();