Saturday, May 23, 2015

Resolve ORA-12505 with a JDBC thin client

Resolve ORA-12505 with a JDBC thin client

Recently Katyuska, a volunteer tester of EasyHA MonitoringTool reported a bug.  When the EasyHA connected to Oracle database and retrieve data, the EasyHA failed to connect and the job was stoped.

The log showed that the jdbc connection was not created successfully.

Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

                at oracle.net.ns.NSProtocol.connect(NSProtocol.java:385)
                at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
                at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
                ... 24 more

The JDBC connection URL is

jdbc:oracle:thin:@localhost:1521:XE

And then I suggest change the URL to

jdbc:oracle:thin:@localhost:1521/XE

Note: Between 1521 and XE should be “/”, not “:”.

Update of EasyHA

The “Help Dialog” of JDBC connection settings has been updated.

Thanks

Thank Katyuska for reporting the bug. If you want to be volunteer tester of EasyHA, please contact me via Facebook or LinkedIn.

More Information on Oracle 1521.

A widely seen situation with ORA-12505 concerns "JDBC Thin Connection Confusion between Service and SID Results in ORA-12505"  This issue is seen in version 11.5.10 on all platforms, and occurs when the JDBC thin connector tries to connect between the RAC with the Service name instead of SID.

The problem here is that the JDBC connect string des not have the appropriate SID name, causing ORA-12505 to interfere. 

Osama Mustafa offers this listener solution to resolve ORA-12505 with a JDBC thin client.

jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SCAN-LISTENER-NAME)(PORT=1530))(CONNECT_DATA=(SERVICE_NAME=Service-name)))




No comments:

Post a Comment