How to use Oracle's connected pool (JDBC)

xiaoxiao2021-03-06  61

The following is just the code snippet, if you need it, you can adjust it yourself :) The driver provided by other database vendors will also have a similar function, and the ideas are also consistent, and the API documentation can be referred to the driver itself.

Import oracle.jdbc.pool. *;

OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource (); ocpds.setURL (this.db_url); // JDBC URL for Oracle ocpds.setUser (this.db_user); // username ocpds.setPassword (this.db_pass); // password connPool = new OracleConnectionCacheImpl (ocpds); // Set the maximum number of connections connPool.setMinLimit (this.min); connPool.setMaxLimit (this.max); // set the scheme connPool.setCacheScheme (OracleConnectionCacheImpl.DYNAMIC_SCHEME); Connection conn = connPool .getConnection ();

转载请注明原文地址:https://www.9cbs.com/read-111762.html

New Post(0)