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; } }
时间: 2024-10-29 19:10:10