package com.java2.BaseDao;

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


public class BaseDao {
	public static final String DRIVER="com.mysql.jdbc.Driver";
	  public static final String URL="jdbc:mysql://127.0.0.1:3306/music";
	  public static Connection getConnection(){
		  Connection conn=null;
		  try {
			Class.forName(DRIVER);
			  conn=DriverManager.getConnection(URL,"root","root");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		  return conn;
	  }
	  public static void release(Connection conn,PreparedStatement pst,ResultSet rs){
		  try {
			if(conn!=null){
				  conn.close();
				  conn=null;
			  }
			  if(pst!=null){
				  pst.close();
				  pst=null;
			  }
			  if(rs!=null){
				  rs.close();
				  rs=null;
			  }
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	  }
}
最近下载更多
996171721  LV7 2023年9月24日
微信网友_6260196253601792  LV7 2022年12月16日
爱丽淇  LV5 2022年5月4日
waitingforyou  LV20 2022年4月18日
wanglinddad  LV55 2022年3月21日
wangdongtai  LV31 2021年8月2日
maozi0802  LV4 2021年6月21日
宁喜43  LV1 2021年6月5日
麻辣香锅加锐澳  LV7 2021年5月28日
明123456  LV11 2021年5月27日
最近浏览更多
微信网友_7229305359568896  LV1 2024年10月28日
赵鑫cdsaljkdfsa  LV11 2024年7月2日
15719908287  LV9 2024年6月19日
lldddfff  LV1 2024年4月7日
15103432984  LV2 2024年3月17日
ncyhhh  LV2 2023年11月26日
微信网友_6680567232876544  LV8 2023年10月11日
996171721  LV7 2023年9月24日
asadda  LV2 2023年6月27日
空中飞尘  LV13 2023年6月13日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友