title: Execute SQL file from Spring JDBC Template
body: <p>I'm trying to write a bit of code that reads a SQL file (multiple <code>CREATE TABLE</code> statements separated by <code>;</code>) and executes all the statements.</p>
  
  <p>In pure JDBC, I could write:</p>
  
  <pre><code>String sqlQuery = "CREATE TABLE A (...); CREATE TABLE B (...);"
  java.sql.Connection connection = ...;
  Statement statement = connection.createStatement();
  statement.executeUpdate(sqlQuery);
  statement.close();
  </code></pre>
  
  <p>and both (all) the statements got executed. When I tried to do the same in spring JdbcTemplate, only the first statement is executed though!</p>
  
  <pre><code>String sqlQuery = "CREATE TABLE A (...); CREATE TABLE B (...);"
  org.springframework.jdbc.core.JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
  jdbcTemplate.execute(sqlQuery);
  </code></pre>
  
  <p>Is there a way to execute multiple statements? While googling I found only solutions like "split the sqlQuery by <code>;</code> manually" which of course is useless (it'd require much more parsing).</p>