0

我正在尝试使用 db2 jdbc 驱动程序激活 statementPool,但我在这样做时遇到了麻烦。我尝试了这里提到的不同技术:http: //publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.java%2Fsrc%2Ftpc%2Fimjcc_c0052041。 htm

这是Java代码:

csUrl += ":maxStatements=1000;";
System.err.println("Connecting to csUrl : " + csUrl);

DB2ConnectionPoolDataSource ds = new DB2ConnectionPoolDataSource();
//DB2SimpleDataSource ds = new DB2SimpleDataSource();
//ds = new DB2ConnectionPoolDataSource();
ds.setServerName("edited");
ds.setPortNumber(edited);
ds.setDatabaseName("edited");
ds.setCurrentSchema("edited");
ds.setMaxStatements(1000);
ds.setDriverType(4);
Connection connection = ds.getPooledConnection(csUser, csPassword).getConnection();
//Connection connection = ds.getConnection(csUser, csPassword);
//Connection connection = DriverManager.getConnection(csUrl);
//Connection connection = m_driver.connect(csUrl, propertiesUserPassword);
boolean pooling = connection.getMetaData().supportsStatementPooling();
if (pooling) {
System.err.println(">>> Pooling is ON!");
} else {
System.err.println(">>> Pooling is OFF! <<<");
}

所有技术都根据 : 失败, connection.getMetaData().supportsStatementPooling()并且 statementPooling 始终处于停用状态。

我正在运行 DB2 Express /Linux : Database server = DB2/LINUXX8664 10.1.2 和匹配的 jdbc 驱动程序。

使用不同 db2 后端(db2 10 zOs)的相同代码给出相同的结果,所以我猜这不是 Express 问题。客户端代码在 Windows 上运行。

我们有一个内部语句缓存,但我想玩一下 DB2,尤其是因为它显然可以在通过 PooledDataSource 提供的逻辑连接之间共享池

谢谢 :)

4

0 回答 0