@Provides @Singleton // Note: we need to inject the pooled DataSource here, not the (direct) one from EmbeddedDB protected GlobalLocker provideGlobalLocker(final DataSource dataSource, final EmbeddedDB embeddedDB) throws IOException { if (EmbeddedDB.DBEngine.MYSQL.equals(embeddedDB.getDBEngine())) { return new MySqlGlobalLocker(dataSource); } else if (EmbeddedDB.DBEngine.POSTGRESQL.equals(embeddedDB.getDBEngine())) { return new PostgreSQLGlobalLocker(dataSource); } else { return new MemoryGlobalLocker(); } }
protected synchronized void executePostStartupScripts() throws IOException { final String databaseSpecificDDL = "org/killbill/billing/util/" + "ddl-" + instance.getDBEngine().name().toLowerCase() + ".sql"; installDDLSilently(databaseSpecificDDL);
@Provides @Singleton // Note: we need to inject the pooled DataSource here, not the (direct) one from EmbeddedDB protected GlobalLocker provideGlobalLocker(final DataSource dataSource, final EmbeddedDB embeddedDB) throws IOException { if (EmbeddedDB.DBEngine.MYSQL.equals(embeddedDB.getDBEngine())) { return new MySqlGlobalLocker(dataSource); } else if (EmbeddedDB.DBEngine.POSTGRESQL.equals(embeddedDB.getDBEngine())) { return new PostgreSQLGlobalLocker(dataSource); } else { return new MemoryGlobalLocker(); } }
protected DataSource createHikariDataSource() throws IOException { switch(getDBEngine()) { case MYSQL: dataSourceClassName = "org.mariadb.jdbc.MySQLDataSource";
embeddedDB.start(); if (embeddedDB.getDBEngine() == EmbeddedDB.DBEngine.POSTGRESQL) { embeddedDB.executeScript("CREATE DOMAIN datetime AS timestamp without time zone;" + "CREATE OR REPLACE FUNCTION last_insert_id() RETURNS BIGINT AS $$\n" +
protected synchronized void executePostStartupScripts() throws IOException { final String databaseSpecificDDL = "org/killbill/billing/util/" + "ddl-" + instance.getDBEngine().name().toLowerCase() + ".sql"; installDDLSilently(databaseSpecificDDL);