package org.diagbot.graph.util;

import org.diagbot.pub.utils.PropertiesUtil;

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

/**
 * mysql连接
 * Created by DELL on 2018/11/28.
 */
public class MysqlConnUtil {
    /**
     * 获取mysql连接
     * @return
     */
    public Connection getMysqlConnection(){
        PropertiesUtil propertiesUtil = new PropertiesUtil("bolt.properties");
        String url = propertiesUtil.getProperty("url_235");
        String userNmae = propertiesUtil.getProperty("userNmae_235");
        String pass = propertiesUtil.getProperty("pass_235");
        Connection conn =null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection(url, userNmae, pass);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return conn;
    }
}
