Odd Connection URL

One of our clients 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:

  • I have never seen such a connection URL before. This is more like an entry in TNSNAMES.ORA. How can I find out what this connection string means?

  • What can cause this useless error message?

+4
source share
2 answers

The syntax is the syntax of the Oracle Net syntax descriptor, see table 8.3 in the JDBC Developer's Guide .

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

As for the specific problem, it seems to me that the descriptor has unbalanced parentheses, in particular:

 (FAILOVER=ON)LOAD_BALANCE=OFF) 

Must be:

 (FAILOVER=ON)(LOAD_BALANCE=OFF) 

(note the optional ( .)

+7
source

I created the following connection url from the tnsnames entry:

 jdbc:oracle:thin:@server1.domain.com:1521/FOO 

try using the above connection url. Also check if the listener is working: in the windows: ctrl + r , services.msc , check if the service is running: "Oracle * TNSListener".

 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))) 
0
source

All Articles