}
}
private void prepareDatabase(String driver, String url, String username, String password, String isolation) {
//Setup the data source
DataSourceConfig ds = new DataSourceConfig();
ds.setDriver(driver);
ds.setUrl(replaceDatabaseString(url));
ds.setUsername(username);
ds.setPassword(password);
ds.setIsolationLevel(TransactionIsolation.getLevel(isolation));
//Setup the server configuration
ServerConfig sc = new ServerConfig();
sc.setDefaultServer(false);
sc.setRegister(false);
sc.setName(ds.getUrl().replaceAll("[^a-zA-Z0-9]", ""));
//Get all persistent classes
List<Class<?>> classes = getDatabaseClasses();
//Do a sanity check first
if (classes.isEmpty()) {
//Exception: There is no use in continuing to load this database
throw new RuntimeException("Database has been enabled, but no classes are registered to it");
}
//Register them with the EbeanServer
sc.setClasses(classes);
//Check if the SQLite JDBC supplied with Bukkit is being used
if (ds.getDriver().equalsIgnoreCase("org.sqlite.JDBC")) {
//Remember the database is a SQLite-database
usingSQLite = true;
//Modify the platform, as SQLite has no AUTO_INCREMENT field
sc.setDatabasePlatform(new SQLitePlatform());