Commit 6209837d by 宋珺琪

数据表统计功能

parent 830c8cd2
package com.founder.commonutils.util;
import java.sql.*;
public class JDBCUtil {
private static final String DRIVER = "com.mysql.cj.jdbc.Driver";//驱动类类名
private static final String DBURL = "jdbc:mysql://47.92.48.137:3900/skyp?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai";//连接URL,javaweb为数据库名
private static final String DBUSER = "root";//数据库用户
private static final String DBPASSWORD = "gkptCcYy123";//数据库密码
public static Connection getConnection() {
Connection connection = null;
try {
Class.forName(DRIVER);
connection = DriverManager.getConnection(DBURL,DBUSER,DBPASSWORD);
} catch (Exception e) {
e.printStackTrace();
}
return connection;
}
public static void close(Connection connection, Statement ps, ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (ps != null) {
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment