package util;

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

public class DBHelper {
	public static final String driver="com.mysql.jdbc.Driver";
	public static final String url="jdbc:mysql://localhost:3306/test";
	public static final String username="root";
	public static final String password="123456";
	public static Connection con=null;
	static{
	try {

	Class.forName(driver);//�õ�DriverManager�������潨������ʱʹ��

	} catch (ClassNotFoundException e) {
	e.printStackTrace();
	}
	}
	public static Connection getConnection(){

	if(con==null){

	try {

	con=DriverManager.getConnection(url,username,password);//��������,ʹ�õIJ�����������������������ַ���������

	} catch (SQLException e) {
	e.printStackTrace();

	}
	}
	return con;

	}


}
最近下载更多
liulian666  LV2 2024年7月23日
25jsiahs  LV2 2024年6月26日
吞吞吐吐她  LV6 2024年6月5日
asddwh  LV13 2024年1月3日
zhtssss  LV1 2023年7月4日
oracleanacarge  LV6 2023年7月3日
mrcao95  LV2 2023年6月26日
女王不该在山炮村养花  LV8 2023年4月16日
李亮  LV19 2023年3月6日
Numpile  LV3 2023年3月1日
最近浏览更多
lijinyang  LV1 昨天
xiaomao111 6月21日
暂无贡献等级
g1121345342  LV9 4月29日
zhoubowen  LV3 2024年12月29日
liulian666  LV2 2024年7月23日
25jsiahs  LV2 2024年6月26日
TY0165  LV20 2024年6月22日
微信网友_6808953284677632  LV2 2024年6月21日
1516299986  LV9 2024年6月14日
bw200488  LV6 2024年6月12日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友