2018-02-26 使用c3p0改造JdbcUtils.java

//会去classpath 路径下找名称为c3p0-config.xml文件,然后将获得的需要连接的参数信息
        //设置进来
        private static DataSource ds = new ComboPooledDataSource();
        
        
        //获得连接
        public static Connection getConnection() {
            
            try {
                return ds.getConnection();
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
            
        }
    

你可能感兴趣的:(2018-02-26 使用c3p0改造JdbcUtils.java)