/*
 * 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 asistencia.sqlserverdao;

import java.sql.Connection;
import java.sql.DriverManager;
import asistencia.dao.DAOFactory;

/**
 *
 * @author sistem19user
 */
public class SqlServerDAOFactory extends DAOFactory{
    
    static {
        try {
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

     public static Connection obtenerConexion(String base) {
        Connection conexion = null;
        if (base.equals("asistencia")) {
//            String connectionUrl = "jdbc:sqlserver://172.16.0.25:1433; databaseName=BDASISTENCIA10_SACOOLIVEROS; user=sa; password=WEB$VITEL2015;";
            String connectionUrl = "jdbc:sqlserver://172.16.2.102:1433; databaseName=trismegistoasistencia; user=sa; password=Saco1357$;";

            try {
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                conexion = DriverManager.getConnection(connectionUrl);
            } catch (Exception e) {
                e.printStackTrace();
                System.err.println("Error en ObtenerConexion - SqlServerDAOFactory : " + e.getMessage());
            }
//        } else if (base.equals("integrado")) {
//            String connectionUrl = "jdbc:sqlserver://172.16.0.25:1433; databaseName=integrado; user=sa; password=WEB$VITEL2015;";
//            try {
//                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//                conexion = DriverManager.getConnection(connectionUrl);
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//        }
        }
        return conexion;
    }

  

}
