首页>代码>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();
        }
    }
}
最近下载更多
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日
caohanren  LV11 2022年12月17日
微信网友_6255730581377024  LV1 2022年12月14日
exkikk  LV1 2022年12月12日
最近浏览更多
chenpeng27 4月16日
暂无贡献等级
zolscy  LV12 4月7日
邓艺妮 4月3日
暂无贡献等级
阿昌先生  LV13 4月1日
quartz  LV7 3月13日
阿卡丽  LV3 2月7日
gxxxxx 1月25日
暂无贡献等级
heshao  LV2 1月24日
kaye7549317 1月16日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友