Updated to new WebServer-Version
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package org.openautonomousconnection.oac2web.utils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Very small JDBC helper for the oac2web registrar frontend.
|
||||
*/
|
||||
public final class Oac2WebDb {
|
||||
|
||||
private final String url;
|
||||
private final String user;
|
||||
private final String password;
|
||||
|
||||
/**
|
||||
* Creates a JDBC helper.
|
||||
*
|
||||
* @param url JDBC url
|
||||
* @param user JDBC username
|
||||
* @param password JDBC password
|
||||
*/
|
||||
public Oac2WebDb(String url, String user, String password) {
|
||||
this.url = Objects.requireNonNull(url, "url");
|
||||
this.user = Objects.requireNonNull(user, "user");
|
||||
this.password = Objects.requireNonNull(password, "password");
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a new JDBC connection.
|
||||
*
|
||||
* @return connection
|
||||
* @throws SQLException if open fails
|
||||
*/
|
||||
public Connection open() throws SQLException {
|
||||
return DriverManager.getConnection(url, user, password);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user