Connection not closing. #4673
Replies: 5 comments 8 replies
-
When using a Database Writer in query mode mirth will reuse the same connection on the next insert rather than opening and closing a connection for each message. |
Beta Was this translation helpful? Give feedback.
-
Any suggestions? Is there a way to get mirth connect to close the destination database connection? Put the Database Writer into INSERT mode instead of QUERY mode? |
Beta Was this translation helpful? Give feedback.
-
Some channels that INSERT into ORACLE don't hold onto the connection. The ones that INSERT into PostgreSQL do hold onto connection. Something is different with the driver or the closing of a connection. Permanently holding onto a destination (Database Writer) connection when there are no more messages does not make any sense and cannot be considered "working correctly". Most databases also have a timeout setting, which means that when the channel runs again (say 24 hours later) that connection is bad/stale anyway and won't work and Mirth connect would have to refresh/get a new connection). There is no way that this is correct. |
Beta Was this translation helpful? Give feedback.
-
I have a fix for this but it is a really ridiculous to have to do this.
|
Beta Was this translation helpful? Give feedback.
-
I'd think you would want the connection to stay open given the potential overhead of opening a connection. Of course there are exceptions, e.g. reading / writing that DB just once or very spread out during the day. If that's the use case, it's a fair request as an optional config thing, but I would want not want that as the default behavior. Having said that, I always use a cached db connection, and never close it - that is far easier to manage IMO. So effectively the connection to the database server is always open since so many channels and processes would be opening/closing it unnecessarily. That connection is persisted in $g. The code template here: https://forums.mirthproject.io/forum/mirth-connect/support/16507-configuration-map?p=93365#post93365. I did not write it - I think it might have originated from the Mirth Advanced class. |
Beta Was this translation helpful? Give feedback.
-
Using a simple SQL destination that Inserts into a Postgresql database.
Not using javascript, using the Mirth UI.
When channel is done the database still shows the connection being used and mirth connect does not close it.
Mirth Connect Server 3.10.0
Built on November 5, 2020
Java version: 1.8.0_181
Beta Was this translation helpful? Give feedback.
All reactions