oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

could not resolve the connect identifier specified #163

Closed rdpanek closed 8 years ago

rdpanek commented 8 years ago

Hi, I have runed Docker version 1.7.0, build 0baf609 image with ubuntu 14.04 and I try this library.

I use example:

var oracledb = require('oracledb');
var dbConfig = require('./dbconfig.js');

oracledb.getConnection(
  {
    user          : dbConfig.user,
    password      : dbConfig.password,
    connectString : dbConfig.connectString
  },
  function(err, connection)
  {
    if (err) {
      console.error(err.message);
      return;
    }

    console.log('Connection was successful!');

    connection.release(
      function(err)
      {
        if (err) {
          console.error(err.message);
          return;
        }
      });
  });

and dbconfig.js

module.exports = {
  user: "login",
  password: "pass",
  connectString: "//hostname:port/ServiceName"
};

When run node ./connection.js is result ORA-12154: TNS:could not resolve the connect identifier specified

Where a problem and how should I proceed, thanks _

cjbj commented 8 years ago

Do you connect to the DB from other tools? What connect string do they use? On the DB machine, try 'lsnrctl services' Your problem isn't specific to node-oracledb so other resources on the web may help you.

rdpanek commented 8 years ago

@cjbj yeah, I normally use SQL Developer and now I want work with DB via nodejs. I known, that isn't problem `node-oracledb_ I only search help :-)

cjbj commented 8 years ago

@rdpanek this is the place to get help. If you give us more info we can take it further. If you're using SQLDeveloper, this might help: https://github.com/oracle/node-oracledb/blob/master/doc/api.md#notjdbc

kgajowy commented 8 years ago

@rdpanek @cjbj

I have similar issue, it worked fine with 0.3.1 (migration finally), which still works fine on our corporate server. However, locally, it no longer works... I had to contact department responsible after checking even connection with sqlplus... which proved to had problems too!

The solution for this in my case was to find sqlnet.ora file and change

names.directory_path = (TNSNAMES)

into

names.directory_path = (TNSNAMES, EZCONNECT)