Skip to main content
  1. Posts/

JDBC Driver Settings for Oracle RAC

Table of Contents

If you are modifying your java application to use Oracle Real Application Clustered (RAC) Database instead of standard single-node database server (Express or Standard edition), then you need to modify settings of your JDBC driver.

Oracle Thin Driver #

Oracle thin driver’s jdbc URL needs to be changed:

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON)
(ADDRESS=(PROTOCOL=TCP)(HOST=tst-db1.myco.com)(PORT=1604))
(ADDRESS=(PROTOCOL=TCP)(HOST=tst-db2.myco.com)(PORT=1604)))
(CONNECT_DATA=SERVICE_NAME=mydb1.myco.com)(SERVER=DEDICATED)))

Also, it is highly recommended to use LDAP directory server instead of hardcoding hostnames into configuration directly:

The point of a tnsnames file, the older Oracle Names server, and the newer, recommended LDAP directory server method of resolving database names is to avoid having to hardcode hostnames, addresses, ports, etc. into your connection string. The DBAs should be able to move the database to a new host or port without breaking anything. The best way to set your thin connect URL is with the following syntax:

jdbc:oracle:thin:@ldap://<OID server name>:<OID port>/<DB SID or Service Name>,cn=OracleContext,dc=<yourdomain>

stackoverflow

More detailed information on configuring JDBC driver for RAC you may find on the Oracle’s site: