import java.sql.Connection;
import java.sql.DriverManager;

import pers.xkk.telbook.util.Constant;

public class DBHelper {

    private Connection conn = null;

    public DBHelper() {
        try {
            Class.forName(Constant.JDBC_NAME);// 指定连接类型
            this.conn = DriverManager.getConnection(Constant.JDBC_URL,
                    Constant.UESR_NAME, Constant.PASSWORD);// 获取连接
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void setConn(Connection conn) {
        this.conn = conn;
    }

    public Connection getConn() {

        return this.conn;
    }
}
 posted on 2015-08-25 18:47  码农xk  阅读(280)  评论(0编辑  收藏  举报