web stats
Best practices for managing DB connections and objects - Page 2 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #11  
Old 04-11-2017, 11:42 PM
dpoply dpoply is offline
Mirth Newb
 
Join Date: Dec 2016
Posts: 13
dpoply is on a distinguished road
Default Can the given connection pool be used for SQL Server?

Quote:
Originally Posted by hugosoares2 View Post
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

Can I use Oracle UCP for SQL Server as well?
Reply With Quote
  #12  
Old 12-10-2017, 09:47 PM
williamxie williamxie is offline
What's HL7?
 
Join Date: Dec 2017
Posts: 4
williamxie is on a distinguished road
Default

Quote:
Originally Posted by hugosoares2 View Post
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
only support for oracle database? how to implement the connection pool in other database, ex, MS SQL Server?
Reply With Quote
  #13  
Old 12-13-2017, 12:48 AM
williamxie williamxie is offline
What's HL7?
 
Join Date: Dec 2017
Posts: 4
williamxie is on a distinguished road
Default

What's your ending up solution for this situation?
Reply With Quote
  #14  
Old 07-22-2019, 10:39 AM
StickyBandit's Avatar
StickyBandit StickyBandit is offline
Mirth Guru
 
Join Date: Aug 2013
Location: Home Alone
Posts: 951
StickyBandit is on a distinguished road
Question

Why do we need UCP.jar in mirth connect if the pool is already setup in
oracle and all we need is a connection from the pool?
The URL has
:POOLED
on it. etc..
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 03:37 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation