Druid线程池创建Connection
Druid线程池创建Connection
代码实现
public class DruidTest {
public static void main(String[] args) throws Exception {
new DruidTest().getConnection();
}
public Connection getConnection() throws Exception {
Properties properties = new Properties();
FileInputStream is = new FileInputStream("D:\\MYcode_K\\JDBC\\learn01\\src\\druid.properties");
properties.load(is);
DataSource dataSource = DruidDataSourceFactory.createDataSource(properties);
return dataSource.getConnection();
}
}