Skip to content

Error to connect through node-oracledb ORA-12170: TNS: Connect timeout  #502

@ghost

Description

Trying to run a simple query using node-oracledb for nodejs. But i am always getting: 2016-09-06T16:25:40.665Z, [request,info] data: ORA-12170: TNS: Connect timeout occurred

  let queryUserId = 'SELECT'
              + ' USER_ID '
              + 'FROM'
              + ' USERS '
              + 'WHERE'
              + ' USER_LOGIN = (:email) ';


  oracledb.getConnection({user: config.User,password: config.Password,connectString: "gcu12304.server.domain.com:1526/BMI"}, function(err, connection) {
    if (err){
      req.log(['info'], err.message);
      res(JSON.stringify({ "name":"Error", "value": err.message }));
      return;
    }

    connection.execute( queryUserId,{ email: req.params.email },function(err, result){
      if (err){
        req.log(['info'], err.message);
        doRelease(connection);
        return;
      }

      req.log(['info'], "Row Count: "+result.rows.length);
      result.rows.length;
      if (result.rows.length>0){
        result.rows.forEach(function(row,index) {
          let rowDB  = {};

          rowDB.user_id = row[0];
          array.push(rowDB);
        });
        doRelease(connection);
        res(JSON.stringify({ "name":"Success", "value": array }));
      }
      else{
        let rowDB  = {};
        rowDB.user_id=0;
        arrayBPMs.push(rowDB);
        res(JSON.stringify({ "name":"Error", "value": array}));
      }
    });
  });

I can connect to the oracle remote server by using telnet and ping command is working successfully from the application server, but the above code is always throwing error: ORA-12170: TNS: Connect timeout occurred, this is the output command from code and telnet.

[user@serverTest]$ node app.js
Error: Error: ORA-12170: TNS:Connect timeout occurred
{"name":"Error","value":"ORA-12170: TNS:Connect timeout occurred\n"}
[user@server Test]$
[user@server Test]$ telnet gcu12304.server.domain.com 1526
Trying xx.xxx.xx.xxx...
Connected to gcu12304.server.domain.com.
Escape character is '^]'.
exit
Connection closed by foreign host.
[user@server Test]$

I have installed the following oracle-client version
oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64

My node version is v5.7.0 and my Linux is RHEL6

Could you please help me to understand what could be wrong??
Thank you node-oracledb team

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions