@Override
public Connection getConnection(String username, String password) throws SQLException {
if (orientDB == null) {
Properties info = new Properties(this.info);
info.put("user", username);
info.put("password", password);
final String serverUsername = info.getProperty("serverUser", "");
final String serverPassword = info.getProperty("serverPassword", "");
String orientDbUrl = dbUrl.replace("jdbc:orient:", "");
OURLConnection connUrl = OURLHelper.parseNew(orientDbUrl);
OrientDBConfig settings = OrientDBConfig.builder()
.addConfig(OGlobalConfiguration.DB_POOL_MIN, Integer.valueOf(info.getProperty("db.pool.min", "1")))
.addConfig(OGlobalConfiguration.DB_POOL_MAX, Integer.valueOf(info.getProperty("db.pool.max", "10")))
.build();
orientDB = new OrientDB(connUrl.getType() + ":" + connUrl.getPath(), serverUsername, serverPassword, settings);
if (!serverUsername.isEmpty() && !serverPassword.isEmpty())
orientDB.createIfNotExists(connUrl.getDbName(), connUrl.getDbType().orElse(ODatabaseType.MEMORY));
pool = new ODatabasePool(orientDB, connUrl.getDbName(), username, password);
}
return new OrientJdbcConnection(pool.acquire(), orientDB, info);
}