Search code examples
node.jsoracle-databasenode-oracledb

Connecing to OracleDB using SID with node-oracledb fails


I am trying to connect to Oracle DB using SID and getting the below error

Error getting the connection - Error: ORA-12545: Connect failed because target host or object does not exist

I have tried following connect strings :

HOST:1521:SID

HOST:1521/SID

HOST, PORT and SID are all correct and I am able to connect using DBVisualizer.

Also, I am able to connect successfully using the SERVICE NAME with both DBVisualizer and node application.

Can someone help me out in connecting with SID?


Solution

  • I assume you are connecting to Oracle Database 12c. By default you no longer can connect using HOST:PORT:SID. If you still need to, add the parameter USE_SID_AS_SERVICE_listener=on to your listener.ora file and reload (lsnrctl reload)

    For more information: https://oracle-base.com/articles/12c/multitenant-connecting-to-cdb-and-pdb-12cr1