primero
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package es.madrid.red.metro.anp.conexion;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import es.madrid.red.metro.anp.exception.RedMetroException;
|
||||
|
||||
public class ConexionDB {
|
||||
|
||||
private ConexionDB() {}
|
||||
|
||||
public static Connection getConexion() throws RedMetroException {
|
||||
try {
|
||||
Class.forName(ConfigConexion.get("db.driver"));
|
||||
return DriverManager.getConnection(
|
||||
ConfigConexion.get("db.url"),
|
||||
ConfigConexion.get("db.user"),
|
||||
ConfigConexion.get("db.password")
|
||||
);
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
throw new RedMetroException("Error al conectar con la base de datos", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user