web stats
Mirth Community - View Single Post - Best practices for managing DB connections and objects
View Single Post
  #6  
Old 04-20-2016, 05:28 AM
hugosoares2 hugosoares2 is offline
OBX.2 Kenobi
 
Join Date: May 2011
Posts: 64
hugosoares2 is on a distinguished road
Default

Unfortunatly I cant share the code but here a re some pointers.

First add Oracle UCP jar to Mirht Resources. (be sure to download the correct jar for your jdbc driver version)
http://www.oracle.com/technetwork/da...ex-091264.html

Then on the Global script:
Code:
//Load ucp pool
var mgr = Packages.oracle.ucp.admin.UniversalConnectionPoolManagerImpl.getUniversalConnectionPoolManager();
var pds = Packages.oracle.ucp.jdbc.PoolDataSourceFactory.getPoolDataSource();
pds.setConnectionPoolName("MyPOOL");
pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
//...set any other properties on the pool

mgr.createConnectionPool(pds);
mgr.startConnectionPool("MyPOOL");

//Save it on globall map
globalMap.put("MyPOOL", pds);
On a any javascript context you can now get connections from the pool
Code:
var pds = globalMap.get("MyPOOL");
var conn = pds.getConnection(); //java.sql.Connection

//Use the connection and then close it to return it to the pool
To manage you UCP Pool you can use the UCP manager and to get some stats on the pool you can use the pool data source object.
https://docs.oracle.com/database/121....htm#JJUCP8223
Reply With Quote