Cannot connect to Oracle Service Name only SID
Unable to connect to an external database using service name.
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.
The root cause of this problem is in a third-party product.
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:
(ADDRESS = (PROTOCOL = TCP)(HOST = sever.pega.com)(PORT = 1521))
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.pega.com)
The connection url should look like this