web stats
Database connection Pool - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-03-2018, 10:52 PM
hgdevanand hgdevanand is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 27
hgdevanand is on a distinguished road
Default Database connection Pool

Hi All,

I have a Mirth setup where i am doing too many database read and write from multiple channels.

I would like to have some kind of connection pool to be implemented in my Mirth so that i can reuse the connection rather than creating and closing the connection every time/ in every channel.

Need help in creating such a setup in my Mirth.

Regards,
Dev
Reply With Quote
  #2  
Old 06-04-2018, 01:21 AM
siddharth siddharth is offline
Mirth Guru
 
Join Date: Feb 2013
Posts: 841
siddharth is on a distinguished road
Default

http://www.mirthproject.org/communit...onnection+pool

Every other forum threads some way or the other references to this thread above. Go through it.
__________________
HL7v2.7 Certified Control Specialist!
Reply With Quote
  #3  
Old 06-04-2018, 06:10 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,176
agermano is on a distinguished road
Default

Maybe take a look at this, too http://www.mirthcorp.com/community/i...wse/MIRTH-3939
Reply With Quote
  #4  
Old 06-20-2018, 07:20 PM
hgdevanand hgdevanand is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 27
hgdevanand is on a distinguished road
Default

Hi
I tried with files present under below URL

https://www.mirthcorp.com/community/...wse/MIRTH-3939

But the way it is implemented does not seems to be stable. With one single connection the code works well, but when complexity increases with multiple threads accessing DB over HIKARI connection pool, it just fails to work. The older connection seems to be open and also it does not clear old connections which are saved in global map.
In short something is wrong.

Any help to get a stable version of the same ?

Regards,
Dev
Reply With Quote
  #5  
Old 06-20-2018, 10:12 PM
aTom aTom is offline
OBX.3 Kenobi
 
Join Date: Feb 2016
Location: Lake Geneva Area
Posts: 115
aTom is on a distinguished road
Default

Hi,

I've implemented the connection pool in my environment and I got similar troubles.

It might sound strange, and I still don't understand why, the common way to close connections didn't work for me :
Code:
var conn ;
// conn = <get your connection from pool>
// ... do your stuff ...
// close
if(conn) {
  conn.close();
}
I had to be more explicit :
Code:
try {
  conn.close(); 
} catch (e) {
}
Since then connection pools work perfectly for me.

Hope it will help.
__________________
Tom
Reply With Quote
  #6  
Old 06-21-2018, 06:46 AM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,176
agermano is on a distinguished road
Default

Whatever error you were getting in your first example is probably still happening and getting eaten by the try/catch in the second example.
Reply With Quote
  #7  
Old 07-07-2018, 05:33 AM
hgdevanand hgdevanand is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 27
hgdevanand is on a distinguished road
Default

I agree.
Any one who have implemented connection pool for Mirth users (which works ).

Regards,
Dev
Reply With Quote
  #8  
Old 07-07-2018, 06:01 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 615
kirbykn2 is on a distinguished road
Default

I open the connection and put the the connection to the GlobalMap. My channels then access the connection through the globalMap.
__________________
Best,

Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.4
Mirth Connect Version 3.8.0
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_181-b13
PostgreSQL Version 9.6.8
Reply With Quote
  #9  
Old 07-13-2018, 12:48 AM
hgdevanand hgdevanand is offline
OBX.1 Kenobi
 
Join Date: Apr 2015
Posts: 27
hgdevanand is on a distinguished road
Default

Hi,

So do you, close the connection after using it ?

If No, then that way of implementation will have singleton approach and not "connection pool" approach.


Regards,
Dev
Reply With Quote
  #10  
Old 07-13-2018, 04:40 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
 
Join Date: Sep 2014
Location: Michigan
Posts: 615
kirbykn2 is on a distinguished road
Default

The connection as a constant stream of incoming and outgoing requests. So I do not close the connection after each request. I don't think constantly opening and closing the connection makes sense.
__________________
Best,

Kirby

Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.4
Mirth Connect Version 3.8.0
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_181-b13
PostgreSQL Version 9.6.8
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:45 AM.


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