25 lines
620 B
Java
25 lines
620 B
Java
package eu.esa.gemis.anp.conexion;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.DriverManager;
|
|
import java.sql.SQLException;
|
|
|
|
public class ConexionDB {
|
|
|
|
public static Connection getConexion() throws SQLException {
|
|
|
|
try {
|
|
Class.forName(ConfigConexion.get("db.driver"));
|
|
|
|
return DriverManager.getConnection(
|
|
ConfigConexion.get("db.url"),
|
|
ConfigConexion.get("db.user"),
|
|
ConfigConexion.get("db.password")
|
|
);
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
throw new SQLException("No se ha encontrado el driver de la base de datos", e);
|
|
}
|
|
}
|
|
}
|