MysqlDAOFactory.java 1.07 KB
Newer Older
Billy Larru committed
1 2 3 4 5 6 7 8
/*
 * 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 salidasautomaticas.mysqldao;

import java.sql.Connection;
sistem02 user committed
9
import java.sql.DriverManager;
Billy Larru committed
10 11 12 13 14 15 16 17 18
import salidasautomaticas.dao.DAOFactory;
import salidasautomaticas.dao.SalidasDAO;

/**
 *
 * @author sistem08user
 */
public class MysqlDAOFactory extends DAOFactory {

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
	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("nuevo")) {
			try {
				String url = "jdbc:mysql://172.16.2.43:3306/nuevo";
				String username = "billy";
				String password = "billy";

				conexion = DriverManager.getConnection(url, username, password);

			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return conexion;
	}

	@Override
	public SalidasDAO getSalidasDAO() {
		return new SalidasMysqlDAO();
	}
Billy Larru committed
49 50

}