Axel León
Axel León

Reputation: 476

Node OracleDB connection not working in remote server

I'm using oracledb with Node and ExpressJS to develop my app. In localhost, I have no problems in my connections, but I need to configure the project in a server that connects to the database that it's in other server. When I do that, I get the error (Translated from spanish):

Error: Error: ORA-12154: TNS: the specified connection identifier could not be resolved.

This is my configuration code:

const oracleDbConfig = {
    user: "myUser",
    password: "myPassword",
    connectString: "192.168.6.129:1521/myDatabase",
}

Also, if I install my project in the database server and I run the same configuration using localhost, it works with no problem:

const oracleDbConfig = {
    user: "myUser",
    password: "myPassword",
    connectString: "localhost:1521/myDatabase",
}

Please, help me to understand the error.

Upvotes: 2

Views: 2585

Answers (2)

Axel León
Axel León

Reputation: 476

I solved the problem changing the connection string as the documentation says:

const oracleDbConfig = {
    user: "myUser",
    password: "myPassword",
    connectString: "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.6.129)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=myDatabase)))"
}

Both ways are valid, but I only have made it work with this.

Upvotes: 1

Bjarte Brandt
Bjarte Brandt

Reputation: 4461

Troubleshooting:

  1. NetworkCheck: Is your dbnode reachable? : dig,ping,host,nslookup
  2. FirewallCheck: Can you connect to the dbnode oracle listener? nc -vz dbnode 1521
  3. ServiceCheck: Is the database service myDatabase exposed in listener on dbnode? dbnode>$lsnrctl status | grep myDatabase

If you can mark these tree points a success, you should be able to connect.

Best of luck.

Upvotes: 1

Related Questions