日期:2014-05-16 浏览次数:20473 次
ConnectionProvider cp = ConnectionProviderFactory.newConnectionProvider(); Connection conn = null; //这里是获取连接 try { conn = cp.getConnection(); } catch (SQLException e) { e.printStackTrace(); } //关闭连接这样用,连接才能够被放回连接池 try { cp.closeConnection(conn); } catch (SQLException e) { e.printStackTrace(); }