title: Importing a (mysql) database dump programmatically through Java
body: <p>How can I import a mysql database dump file (contains insert and create table statements) programmatically through a java program. I need this as the setup phase of a unit test. </p>
  
  <p>Unfortunately this doesn't work:</p>
  
  <pre><code>Connection conn = dbConnectionSource.getConnection();
  Statement stmt = conn.createStatement();
  stmt.execute(FileUtils.readFileToString(new File("./some-sql-file")));
  conn.close();
  </code></pre>
  
  <p>Thanks,
  -A</p>
  
  <p>PS - In Rails, I used fixtures for filling a test database. I made rails rails create the underlying tables through setting the environment to test, anything similar in Java.</p>