I am coding an application that connects to a localhost. When the application first runs I want it to initialize the Database using this method:
public void initDataBase() {
try {
Statement stm = con.createStatement();
stm.executeQuery("source shippingSQLscript.sql");
} catch (SQLException ex) {
ex.printStackTrace();
}
}
Where shippingSQLscript.sql contains the correct sql statements to insert all the data. However when I run it the method throws:
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 'source shippingSQLscript.sql'
at line 1
I have tried using stm.execute() as well but have had the same result.
stm.execute()s. I wish I could have found one, but there isn't any :( No matter I can make a method like it myself.