return driver;
}
@Override
public Connection newConnection(Properties properties, Principal principal) throws SQLException {
User user = null;
if (principal != null) {
if (principal instanceof User) {
user = (User)principal;
}
else {
// Translate from Java security realm (e.g., Jetty) to SQL Layer.
user = reqs.securityService().getUser(principal.getName());
}
}
if (user != null) {
properties.put("user", user.getName());
properties.put("database", user.getName());
}
else if (!properties.containsKey("user")) {
properties.put("user", ""); // Avoid NPE.
}
Connection conn = driver.connect(JDBCDriver.URL, properties);