Created
April 16, 2018 12:30
-
-
Save aslakhellesoy/f3dd2632047df42dec71d1192f3262f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JdbcSchema { | |
public static void createTables(Connection connection) throws SQLException, URISyntaxException, IOException { | |
// Stupid Scanner trick: https://community.oracle.com/blogs/pat/2004/10/23/stupid-scanner-tricks | |
String sql = new Scanner(JdbcSchema.class.getResourceAsStream("sqlite.sql"), "UTF-8").useDelimiter("\\A").next(); | |
for (String stmt : sql.split("-- 8< --")) { | |
connection.createStatement().executeUpdate(stmt); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment