JDBC - DBCP连接池

 1 public class DBCPUtils {
 2 
 3     /**
 4      * DBCP数据库连接池
 5      */
 6     private static DataSource source;
 7 
 8     static {
 9         try {
10             Properties pros = new Properties();
11             FileInputStream is = new FileInputStream(new File("src/dbcp.properties"));
12             pros.load(is);
13             source = BasicDataSourceFactory.createDataSource(pros);
14         } catch (Exception e) {
15 
16         }
17     }
18 
19     public static Connection getConnection(){
20         Connection conn = source.getConnection();
21         return conn;
22     }
23 }

 

JDBC - DBCP连接池

上一篇:sql 函数 find_in_set, concat


下一篇:SQL常用语句2——截取字符,连接字符,数据类型的转换