use of org.sqlite.SQLiteDataSource in project GeoGig by boundlessgeo.
the class XerialConfigDatabase method connect.
SQLiteDataSource connect(Config config) {
SQLiteDataSource dataSource = Xerial.newDataSource(config.file);
new DbOp<Void>() {
@Override
protected Void doRun(Connection cx) throws IOException, SQLException {
String sql = "CREATE TABLE IF NOT EXISTS config (section VARCHAR, key VARCHAR, value VARCHAR," + " PRIMARY KEY (section,key))";
Statement st = open(cx.createStatement());
st.execute(log(sql, LOG));
sql = "CREATE INDEX IF NOT EXISTS config_section_idx ON config (section)";
st.execute(log(sql, LOG));
return null;
}
}.run(dataSource);
return dataSource;
}
use of org.sqlite.SQLiteDataSource in project flyway by flyway.
the class SQLiteMigrationMediumTest method singleConnectionExternalDataSource.
@Test
public void singleConnectionExternalDataSource() {
SQLiteConfig config = new SQLiteConfig();
config.setJournalMode(SQLiteConfig.JournalMode.WAL);
config.setSynchronous(SQLiteConfig.SynchronousMode.NORMAL);
SQLiteDataSource dataSource = new SQLiteDataSource(config);
dataSource.setUrl("jdbc:sqlite:target/single_external");
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setLocations("migration/sql");
flyway.clean();
flyway.migrate();
}
use of org.sqlite.SQLiteDataSource in project GeoGig by boundlessgeo.
the class Xerial method newDataSource.
public static SQLiteDataSource newDataSource(File db) {
SQLiteDataSource dataSource = new SQLiteDataSource();
dataSource.setUrl("jdbc:sqlite:" + db.getAbsolutePath());
dataSource.setSynchronous(DEFAULT_SYNC_MODE.getValue());
return dataSource;
}
Aggregations