其他分享
首页 > 其他分享> > Druid线程池创建Connection

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();
    }
}

标签:getConnection,Druid,public,Connection,线程,FileInputStream,new,properties
来源: https://www.cnblogs.com/coderDreams/p/15986749.html