 <p>I finally found the solution using the <code>ScriptRunner</code> class you can find on this link: <strong><a href="https://github.com/BenoitDuffez/ScriptRunner" rel="nofollow">https://github.com/BenoitDuffez/ScriptRunner</a></strong>.</p> <p>You can use it as follows: </p> <pre><code>Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/2sga_local" + unicode, "root", ""); ScriptRunner runner = new ScriptRunner(connection, false, false); File fileDir = new File("2sga_local.sql"); BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir), "UTF8")); runner.runScript(in); </code></pre>