package DRUID;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import javax.sql.DataSource;
import java.io.FileInputStream;
import java.sql.Connection;
import java.util.Properties;
public class DruidDemo {
public static void main(String[] args) throws Exception {
//1.導包
//2.定義配置檔案
//3.載入配置檔案
Properties prop = new Properties();
prop.load(new FileInputStream("./src/druid.properties"));
//4.獲取連線池物件
DataSource ds = DruidDataSourceFactory.createDataSource(prop);
//5.獲取資料庫連結
Connection conn = ds.getConnection();
System.out.println(conn);
}
}