My Oracle Support Banner

ORA-12505 When Connecting Using Jdbc. (Doc ID 2926900.1)

Last updated on MAY 01, 2024

Applies to:

JDBC - Version 19.3 and later
Information in this document applies to any platform.

Symptoms

As an example, the Client connection string uses the "SID" value to connect to a <TEST> database instance.
So:

<my_alias> =
(DESCRIPTION =
(ADDRESS=(protocol = tcp)(HOST=<hostname.domain>)(port = 1521))
(CONNECT_DATA=(SERVER=DEDICATED)(SID = <TEST>))
)


However, the <TEST> database is changed to a pluggable database (PDB so Multi-Tenant functionality) and the client connection now fails with ORA-12505.

Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:489)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:254)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at com.markview.common.db.resource.OracleDbResource.createConnection(OracleDbResource.java:68)
... 45 more
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:399)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1140)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340)
... 52 more

Changes

 The TEST database is now a PDB. Connections to a pluggable database use SERVICE_NAME and not SID.

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.