 |
Software > WebSphere >
|
 |
 |
 |
The Oracle database does not cache all of the connections
|
| | | Problem(Abstract) | When you use the oracle.jdbc.pool.OracleConnectionCacheManager custom property with the Oracle.jdbc.pool.OracleDataSource data source, connections to an Oracle database might not be cached. | | | | | | Cause | | Custom properties on an Oracle data source are represented as a collection, which has no particular order. Therefore, it is not possible to configure data source properties in any order that guarantees that all of the connections are cached by the Oracle database. | | | | | Diagnosing the problem | The following samples demonstrate instances in which caching does and does not occur. In the following example, caching occurs: import java.sql.Connection; import java.sql.SQLException; import oracle.jdbc.pool.OracleConnectionCacheManager; import oracle.jdbc.pool.OracleDataSource; public class OraceCachingBug { static String url = null; static OracleConnectionCacheManager occm = null; public static void cacheCreatedSuccessfully() throws Throwable { OracleDataSource ods = new OracleDataSource(); // The following property ordering results in a cache being created. ods.setConnectionCachingEnabled(true); ods.setURL("jdbc:oracle:thin:@localhost:1521:IBM"); ods.setConnectionCacheName("ICC"); ods.setUser("scott"); ods.setPassword("manager1"); Connection conn = ods.getConnection("scott", "manager1"); System.out.println("before: " + occm.getNumberOfAvailableConnections("ICC") + " connections are available in cache ICC"); conn.close(); System.out.println("after: " + occm.getNumberOfAvailableConnections("ICC") + " connections are available in cache ICC"); System.out.println("success"); } In the following example, caching does not occur: public static void noCacheCreatedDueToOraBug() throws Throwable { OracleDataSource ods = new OracleDataSource(); // The following property ordering causes no exception, but no cache is created. ods.setConnectionCacheName("ICC"); ods.setURL("jdbc:oracle:thin:@localhost:1521:IBM"); ods.setConnectionCachingEnabled(true); ods.setUser("scott"); ods.setPassword("manager1"); Connection conn = ods.getConnection("scott", "manager1"); System.out.println("before: " + occm.getNumberOfAvailableConnections("ICC") + " connections are available in cache ICC"); conn.close(); System.out.println("after: " + occm.getNumberOfAvailableConnections("ICC") + " connections are available in cache ICC"); System.out.println("success"); } public static void main(String[] args) throws Throwable { occm = OracleConnectionCacheManager.getConnectionCacheManagerInstance(); System.out.println("test combination that causes cache to NOT get created"); try { noCacheCreatedDueToOraBug(); } catch (SQLException x) { System.out.println("test failed, exception is: " + x); } System.out.println("test combination that causes cache to be created"); cacheCreatedSuccessfully(); System.out.println("all done.."); } } | | | | | Resolving the problem | | Contact Oracle support and reference the 6638862 fix. | | | | | | | | | Cross Reference information | | Segment | Product | Component | Platform | Version | Edition | | Application Servers | WebSphere Application Server for z/OS | DB Connections/Connection Pooling | | 7.0 | |
| | |
 |
| IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml. |
 |
 |
 |
| Please take a moment to complete this form to help us better serve you. |
 |
 |
 |
|
|
|
 |
 |
| Product categories: |
 |
| | Software |  |
| | Application Servers |  |
| | Distributed Application & Web Servers |  |
| | WebSphere Application Server |  |
| | DB Connections/Connection Pooling |  |
 |
| Operating system(s): |
| |
AIX, HP-UX, IBM i, Linux, Solaris, Windows
|
 |
| Software version: |
| |
7.0
|
 |
| Software edition: |
| |
Base, Express, Network Deployment
|
 |
| Reference #: |
| |
1318192
|
 |
| IBM Group: |
| | Software Group |
 |
| Modified date: |
| | 2008-09-25 |
 |
|