// turn our static method into an instance of Main
new DataPersisterMain().doMain(args);
}
private void doMain(String[] args) throws Exception {
JdbcConnectionSource connectionSource = null;
try {
// create our data-source for the database
connectionSource = new JdbcConnectionSource(DATABASE_URL);
// setup our database and DAOs
setupDatabase(connectionSource);
// read and write some data
readWriteData();
System.out.println("\n\nIt seems to have worked\n\n");
} finally {
// destroy the data source which should close underlying connections
if (connectionSource != null) {
connectionSource.close();
}
}
}