package net.h4ckx0r.controlador;

import java.sql.Connection;

public class GestorConexiones {
    static Connection conn = null;

    public static Connection getConexion() {
        if (conn == null) {
            try {
                conn = java.sql.DriverManager.getConnection(getURLConexion());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return conn;
    }

    private static String getURLConexion() {
        String host = "127.0.0.1:3310";
        String schema = "centroeducativo";
        String properties = "?autoReconnect=true&serverTimezone=Europe/Madrid&useSSL=False&allowPublicKeyRetrieval=TRUE";
        String user = "root";
        String password = "1234";

        return "jdbc:mysql://" + user + ":" + password + "@" + host + "/" + schema + properties;
    }
}
