mirror of
https://github.com/vran-dev/databasir.git
synced 2025-08-08 17:32:14 +08:00
fix: properties not work when use custom driver (#150)
* fix: properties not work when use custom driver * fix: checkstyle
This commit is contained in:
@@ -71,14 +71,17 @@ public class CustomDatabaseConnectionFactory implements DatabaseConnectionFactor
|
||||
throw DomainErrors.CONNECT_DATABASE_FAILED.exception("驱动初始化异常:" + e.getMessage());
|
||||
}
|
||||
|
||||
Properties info = new Properties();
|
||||
info.put("user", context.getUsername());
|
||||
info.put("password", context.getPassword());
|
||||
if (context.getProperties() != null && !context.getProperties().isEmpty()) {
|
||||
info.putAll(context.getProperties());
|
||||
}
|
||||
String urlPattern = type.getUrlPattern();
|
||||
String jdbcUrl = urlPattern.replace("{{jdbc.protocol}}", type.getJdbcProtocol())
|
||||
.replace("{{db.url}}", context.getUrl())
|
||||
.replace("{{db.name}}", context.getDatabaseName())
|
||||
.replace("{{db.schema}}", context.getSchemaName());
|
||||
Properties info = new Properties();
|
||||
info.put("user", context.getUsername());
|
||||
info.put("password", context.getPassword());
|
||||
return driver.connect(jdbcUrl, info);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user