This commit is contained in:
Avelino
2026-11-10 06:00:30 +01:00
commit ed438d8cfc
75 changed files with 1746 additions and 0 deletions
@@ -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);
}
}
}