首页>代码>java web慧心人力资源管理系统>/src/com/yuki/dao/DbConnection.java
package com.yuki.dao;
import java.sql.*;

public class DbConnection {
    private static String url = "jdbc:mysql://localhost:3306/hrmanagement?characterEncoding=utf-8&useSSL=false";
    private static String user = "root";
    private static String pass = "root";

    static {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static Connection getConn() {
       Connection conn = null;
        try {
            conn = DriverManager.getConnection(url,user,pass);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return conn;
    }
    public static void getClose(java.sql.Connection conn, PreparedStatement pst, ResultSet rst) {
        try {
            if (rst != null)
                rst.close();
            if (pst != null)
                pst.close();
            if (conn != null)
                conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
最近下载更多
long123_356  LV8 2024年12月22日
cong58cong  LV8 2024年6月26日
今晚都别睡啦  LV9 2024年6月1日
微信网友_6906962132258816  LV7 2024年3月22日
RAINK_L  LV3 2023年12月13日
jiemomo  LV12 2023年10月19日
微信网友_6672184532766720  LV3 2023年10月10日
诺一啊啊啊啊啊  LV3 2023年6月15日
KAIzx11  LV7 2023年6月13日
gala209  LV3 2023年2月2日
最近浏览更多
444105047  LV6 1月17日
cxdddd  LV1 2024年12月31日
yongle  LV1 2024年12月31日
long123_356  LV8 2024年12月22日
120_wu  LV4 2024年12月2日
yimaoermao  LV1 2024年11月28日
张泽帅  LV6 2024年10月18日
040313  LV1 2024年10月16日
4324234ty 2024年7月2日
暂无贡献等级
cong58cong  LV8 2024年6月26日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友