/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.siso.asistenciaAniversario.MySqlDAO;

import java.sql.Connection;
import java.sql.DriverManager;
import pe.siso.asistenciaAniversario.DAO.AsistenciaDAO;
import pe.siso.asistenciaAniversario.DAO.ConteoDAO;
import pe.siso.asistenciaAniversario.DAO.DAOFactory;

/**
 *
 * @author acalderon
 */
public class MySqlDAOFactory extends DAOFactory {

	static {
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static Connection obtenerConexion(String base) {
		Connection conexion = null;
		if (base.equals("aniversario")) {
			try {

				conexion = DriverManager.getConnection(
					"jdbc:mysql://localhost:3306/aniversario",
					"root",
					"Saco1357$");

			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}
		if (base.equals("nuevo")) {
			try {

				conexion = DriverManager.getConnection(
					"jdbc:mysql://172.16.2.43:3306/nuevo",
					"billy",
					"billy");

			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}

		return conexion;
	}

	static Connection obtenerConexion() {
		throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
	}

//    @Override
//    public UsuarioDAO getUsuarioDAO() {
//       return new MySqlUsuarioDAO();
//    }
	@Override
	public AsistenciaDAO getAsistenciaDAO() {
		return new MySqlAsistenciaDAO();
	}

	@Override
	public ConteoDAO getConteoDAO() {
		return new MySqlConteoDAO();
	}

}
