Skip to content

ORA-12560: TNS:protocol adapter error when connecting to database #703

@ShiraazMoollatjie

Description

@ShiraazMoollatjie

I read through this issue (#691) as well as couple others and it did not solve my problem. I am using oracle instant client (client + sdk +sqlplus) 12.2 with the following code:

import oracledb from 'oracledb';

oracledb.getConnection({    
    user: 'appdba',
    password: 'manager',
    // connectionString: '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = server)(PORT = 1521)))(CONNECT_DATA = (SERVICE_NAME = db1))'
    connectionString: 'server1:1521/db1'
    // connectionString: 'db1'
}).then(connection => {
    console.log('Got connection!');
})
.catch(err => {
    console.log(err);
})

my environment variables are set as:

ORACLE_HOME=C:\oracle\instantclient_12_2
OCI_INC_DIR=C:\oracle\instantclient_12_2\sdk\include
OCI_LIB_DIR=C:\oracle\instantclient_12_2\sdk\lib\msvc
TNS_ADMIN=C:\oracle\instantclient_12_2\network\admin

What I tried

  • Connecting with SQLPlus works for me using the credentials and the tnsname
  • Tried to get a stacktrace using err.stack but it returns just Error: ORA-12560: TNS:protocol adapter error
  • The error does not happen immediately upon connect. It seems like it's waiting for ~5-ish seconds before timing out
  • Tried to run node with -verbose and -debug (and wrapped this in an npm task with debug & verbose output) and I can't see anything.

Is there anyway to determine what's wrong or at least print out some debug output to figure things out?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions