Java JDBC Connection with Oracle RAC

Unofficial Content

While tring to connect to a Oracle RAC, the following error may ocour:

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor.

In the DataStore Properties, the values are:

  • JDBC Driver: Oracle Thin (Type 4)
  • Databasename: myrac
  • Servername: orap-cluster.mydomain.com
  • Server TCP/IP Port: 1521

What generates the following URL in the client.cfg file:

jdbc:oracle:thin:@orap-cluster.mydomain.com:1521:myrac

But, instead to connect to a SID, we must connect to a SERVICE, so, the URL must be changed to:

jdbc:oracle:thin:@orap-cluster.mydomain.com:1521/myrac

This is possible changing the following DataStore properties:

  • Use custom JDBC URL: True
  • Custom JDBC URL: jdbc:oracle:thin:@orap-cluster.mydomain.com:1521/myrac

That's all.