Zizou
Zizou

Reputation: 943

Difference between oracle JDBC Thin style URL and descriptor URL

I have googled and found some topics discussing similar topic but never got one thread having final and clear response. We are working on a Java application where we will need to support RAC connections. The question is what is the difference between the two URL styles:

jdbc:oracle:thin:@<host>:1521/<SERVICENAME>
jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=myhost)(PORT=1521)(PROTOCOL=tcp))(CONNECT_DATA=(SERVICE_NAME=myorcldbservicename)))

Is there any best practice to sue one format over the other?

Does the first style supports RAC connection? Does the first style supports failover/load balancing testing? Does it make sense to use the second style and only providing one node? Do we need always to specify all nodes (for the two approches) or is only specifying one node up when the application starts is enough?

Upvotes: 1

Views: 1169

Answers (2)

Nirmala
Nirmala

Reputation: 1338

The first one is called Easy Connect URL and long one is called long form connection URL.

Easy Connect: jdbc:oracle:thin:@:1521/ Long Form Connection URL: jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=myhost)(PORT=1521)(PROTOCOL=tcp))(CONNECT_DATA=(SERVICE_NAME=myorcldbservicename)))

Starting from 19c, Easy connect URL also has been enhanced to support other connection properties through name value pair.

Refer to JDBC Developer's guide for more examples.

For RAC, it might be easier to decode the long form URL if you have multiple hosts. But, technically you can use both.

Upvotes: 0

ssolbach
ssolbach

Reputation: 96

Depending on the client version, the "short" syntax does not support all required attributes required for RAC. So you should use the long format, as it provides all capabilities also when requiring Data Guard.

See:

Even though the first is for Autonomous, they are still applicable even for a standard On-Premises deployment.

For more good whitepapers, see www.oracle.com/goto/maa

Upvotes: 1

Related Questions