贾兆冀个人资料:Proxool 0.9.1连接池的工作特点

来源:百度文库 编辑:九乡新闻网 时间:2024/07/07 14:57:47
Proxool acts as a proxy. That is, when you ask it to do something it delegates that task to another JDBC driver (you can use whatever driver you like). This has an important benefit: you can switch from any JDBC driver to Proxool by simply making a few configuration changes. The standard life cycle of asking the DriverManager for a Connection and then closing that Connection when you have finished with it remains unchanged.
代码:Class.forName("org.logicalcobwebs.proxool.ProxoolDriver");
connection = DriverManager.getConnection(url);
...
connection.close();

When the ProxoolDriver gives you a Connection it actually gives you a ProxyConnection instead. The ProxyConnection does everything that a Connection does except that when you call the close() method it doesn't really close. Instead, it puts itself back into the pool.