Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Odd Oracle connection URL

Tags:

java

oracle

jdbc

One of our customers is trying to connect to an Oracle database with the following JDBC URL:

jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)LOAD_BALANCE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=server1.domain.com)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=server2.domain.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=FOO))) 

They get this error:

Caused by: oracle.net.ns.NetException: NL Exception was generated
    at oracle.net.resolver.AddrResolution.resolveAddrTree(AddrResolution.java:614) ~[ojdbc5_11g-11.2.0.1.0.jar:11.2.0.1.0]
    at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:411) ~[ojdbc5_11g-11.2.0.1.0.jar:11.2.0.1.0]
    at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:672) ~[ojdbc5_11g-11.2.0.1.0.jar:11.2.0.1.0]
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:237) ~[ojdbc5_11g-11.2.0.1.0.jar:11.2.0.1.0]
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042) ~[ojdbc5_11g-11.2.0.1.0.jar:11.2.0.1.0]
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301) ~[ojdbc5_11g-11.2.0.1.0.jar:11.2.0.1.0] 

Questions:

  1. I've never seen such a connection URL before. It looks more like an entry in TNSNAMES.ORA. How can I find out what this connection string means?

  2. What could be causing this useless error message?

like image 599
Aaron Digulla Avatar asked Jan 04 '13 13:01

Aaron Digulla


1 Answers

The syntax is the 'Oracle Net connection descriptor syntax', see table 8.3 in the JDBC Developers Guide.

The syntax is indeed the same as the syntax used in tnsnames.ora; this syntax is described in the Oracle Database Net Services Reference.

As to the specific issue, it looks to me like you have unbalanced parentheses in the descriptor, specifically:

(FAILOVER=ON)LOAD_BALANCE=OFF)

Should be:

(FAILOVER=ON)(LOAD_BALANCE=OFF)

(note the additional (.)

like image 195
Mark Rotteveel Avatar answered Sep 28 '22 06:09

Mark Rotteveel