@@ -0,0 +1,1029 @@
+package com.hunantv.fw.utils;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Iterator;%0Aimport java.util.Map;%0Aimport java.util.Properties;%0A%0Aimport javax.sql.DataSource;%0A%0Aimport org.apache.commons.beanutils.BeanUtils;%0A%0Aimport com.mchange.v2.c3p0.ComboPooledDataSource;%0A%0Apublic class FwC3p0 %7B%0A%0A%09public DataSource getDataSource() throws Exception %7B%0A%09%09Properties pros = new SysConf().read(%22c3p0.properties%22);%0A%09%09DataSource ds = new ComboPooledDataSource();%0A%0A%09%09Map%3CString, Object%3E dsPros = new HashMap%3CString, Object%3E();%0A%09%09for (Iterator iter = pros.keySet().iterator(); iter.hasNext();) %7B%0A%09%09%09String key = (String) iter.next();%0A%09%09%09if (key.startsWith(%22c3p0.%22)) %7B%0A%09%09%09%09System.out.println(key.substring(5));%0A%09%09%09%09dsPros.put(key.substring(5), pros.get(key));;%0A%09%09%09%7D%0A%09%09%09dsPros.put(key, pros.get(key));%0A%09%09%7D%0A%09%09BeanUtils.populate(ds, dsPros);%0A%09%09return ds;%0A%09%7D%0A%09%0A%09public static void main(String%5B%5D args) throws Exception %7B%0A%09%09ComboPooledDataSource ds = (ComboPooledDataSource) new FwC3p0().getDataSource();%0A%09%09System.out.println(ds.getMaxPoolSize());%0A%09%7D%0A%7D%0A

add c3p0 tools