Oracle RAC Configuration

Connecting to oracle RAC (Real Application Cluster) using JDBC with thin driver, the classic url: jdbc:oracle:thin:@<HOST>:1521:<SID> will not work.

The correct URL is as follows:

jdbc:oracle:thin:@(DESCRIPTION=(LOAD_BALANCE=on)
(ADDRESS=(PROTOCOL=TCP)(HOST=host1) (PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=host2) (PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=service)))

The mentioned URL can be obtained from the tnsnames.ora file in the Oracle installation