/*
 * Datos.java
 *
 * Created on 5 de noviembre de 2007, 11:48
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package modelo;

import java.sql.*;
public class Datos {
    
    private String driver;
    private String cadenacon;
    public Datos() {
    }
    public Datos(String driver,String cadenacon){
        this.driver=driver;
        this.cadenacon=cadenacon;
    }
    public Connection getConexion(){
        Connection cn=null;
        try{
            Class.forName(driver).newInstance();
            cn=DriverManager.getConnection(cadenacon);
        }
        catch(Exception e){
            e.printStackTrace();
        }
        return cn;
    }
    public void cierraConexion(Connection cn){       
            try{
                if(cn!=null && !cn.isClosed()){
                    cn.close();
                }
            }
            catch(SQLException e){
                e.printStackTrace();
            }
    }
}
