Support Article
Cannot connect to Oracle Service Name only SID
SA-8524
Summary
Unable to connect to an external database using service name.
Error Messages
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
Steps to Reproduce
- Have a valid configuration to connect to a SID
- Replace SID name with a service name and recycle.
Root Cause
The root cause of this problem is in a third-party product.
Resolution
This is an issue with the Oracle TNS listener most likely. In order to help isolate the problem, perform the following change to the operating environment:
- Execute the "lsnrctl status" command from the oracle server.
- Use any database client tool on the same machine that runs PRPC and connect using the URL that you have provided.
The explanation for this behavior is as follows:
As an example configure the tnsnames.ora file to have an entry similar to the following data:
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = sever.pega.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.pega.com)
)
)
The connection url should look like this
url="jdbc:Oracle:thin:@//sever.pega.com:1521/orcl.pega.com"
Published June 12, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.