当前位置 : 主页 > 编程语言 > c++ >

DBCP实现数据库连接池

来源:互联网 收集:自由互联 发布时间:2021-07-03
gistfile1.txt private static DataSource source;private static ThreadLocal local=new ThreadLocal (); static{ Properties pro = new Properties(); InputStream in = DBCPUtils.class.getClassLoader().getResourceAsStream("dbcpconfig.properties"); t
gistfile1.txt
private static DataSource source;
	private static ThreadLocal
 
   local=new ThreadLocal
  
   (); static{ Properties pro = new Properties(); InputStream in = DBCPUtils.class.getClassLoader().getResourceAsStream("dbcpconfig.properties"); try { pro.load(in); BasicDataSourceFactory factory = new BasicDataSourceFactory(); source = factory.createDataSource(pro); } catch (Exception e) { new ExceptionInInitializerError(e); }
  
 
网友评论