web stats
Using Oracle TNS in the server manager connection string - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 05-26-2015, 02:48 AM
swiftnano swiftnano is offline
What's HL7?
 
Join Date: May 2015
Posts: 2
swiftnano is on a distinguished road
Default Using Oracle TNS in the server manager connection string

Hi,

I have successfully connected to an oracle DB from my channels using a TNS names connection.

I have also connected the Mirth Connect backend to the oracle database with a standard JDBC connection string.
Code:
jdbc:oracle:thin:@servername:1521:dbname
However I would like to be able to connect the server manager using a TNS names connection string as I do in my channels but am unable to.

In order to get a TNS connection to work in my channels I had to set the following property before making the connection.

Code:
Packages.java.lang.System.setProperty("oracle.net.tns_admin", "C:\path to tnsnames.ora");

var dbConnection = DatabaseConnectionFactory.createDatabaseConnection("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@CON_FROM_TNSNAMES", "user", "pass");
I cant see a way to add this property globally or before the connection of the server manager is attempted.

Thanks in advance for your help.

Using Mirth Connect Server 3.2.1.7650
Reply With Quote
  #2  
Old 07-03-2018, 06:51 AM
swiftnano swiftnano is offline
What's HL7?
 
Join Date: May 2015
Posts: 2
swiftnano is on a distinguished road
Default

Thought I would post a solution to my own post in case it helps anyone in the future.

(This was probably obvious to anyone who has used Java a lot but was not to me at the time.)

The full TNS connection string can be added as the jdbc url as it would be found in the tnsnames.ora file.

For example in your tnsnames.ora file you would have the following (or similar for your setup)

Code:
MY_TNS_NAME
(
  DESCRIPTION =
  (CONNECT_TIMEOUT=2)
  (RETRY_COUNT=10)
  (LOAD_BALANCE = on)
  (ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = server2)(PORT = 1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = server3)(PORT = 1521))
  (CONNECT_DATA =
    (SERVICE_NAME = MYSID)
  )
)
So in mirth server manager / config file the jdbc url would be:
Code:
jdbc:oracle:thin:@(   DESCRIPTION =   (CONNECT_TIMEOUT=2)   (RETRY_COUNT=10)   (LOAD_BALANCE = on)   (ADDRESS = (PROTOCOL = TCP)(HOST = server1)(PORT = 1521))   (ADDRESS = (PROTOCOL = TCP)(HOST = server2)(PORT = 1521))   (ADDRESS = (PROTOCOL = TCP)(HOST = server3)(PORT = 1521))   (CONNECT_DATA =     (SERVICE_NAME = MYSID)   ) )
Hope this helps.

Thanks

Last edited by swiftnano; 07-03-2018 at 06:53 AM.
Reply With Quote
Reply

Tags
oracle, tnsnames

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 07:42 PM.


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