0

Im gonna do a datasource Tomcat 9.0.63 to connect to my Oracle DB. Actually we use dataguard (2 db, a main one and a backup one)

In the configuration of server.xml file , in order to set the connection, i wonder in the parameter "URL" if i can use the following syntax:

jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST =(LOAD_BALANCE=off)(FAILOVER=ON) (ADDRESS = (PROTOCOL = TCP)(HOST = HOSTNAMEMAINDB)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = HOSTNAMEBACKUPDB)(PORT = 1521)))(CONNECT_DATA = (SERVICE_NAME = SERVICENAME) (FAILOVER_MODE = (TYPE = SELECT)(METHOD = BASIC)(RETRIES = 120)(DELAY = 5))))

The questio would be if the datasource tomcat would support this syntax

Thank you very much

Ive tried with non Dataguard configuration and that work, i wonder if that would work with this configuration

1 Answers1

0

Yes, it should be a string that is correctly formed. The long form connection string will work.

Another way is to move the entire connection string to a file named tnsnames.ora with a Name-value pair and then use a TNS Alias in the connection URL and TNS_ADMIN pointing to the location of the tnsnames.ora file (jdbc:oracle:thin:@orcldbtest_medium?TNS_ADMIN=/Users/test/). Refer to JDBC developer guide for more details.

Nirmala
  • 1,278
  • 1
  • 10
  • 11