Reputation: 328830
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:
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?
What could be causing this useless error message?
Upvotes: 6
Views: 21468
Reputation: 61
I generated the following connection URL from your tnsnames entry :
jdbc:oracle:thin:@server1.domain.com:1521/FOO
try to use the above connection URL.
Also do check if the listener is up and running :
in windows : ctrl + r, services.msc
, check whether service : "Oracle*TNSListener" is started.
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)))
Upvotes: 0
Reputation: 109243
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 (
.)
Upvotes: 11