[英]Node OracleDB connection not working in remote server
I'm using oracledb with Node and ExpressJS to develop my app.我正在使用带有 Node 和 ExpressJS 的 oracledb 来开发我的应用程序。 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.
在 localhost 中,我的连接没有问题,但我需要在连接到它在其他服务器中的数据库的服务器中配置项目。 When I do that, I get the error (Translated from spanish):
当我这样做时,我收到错误(从西班牙语翻译):
Error: Error: ORA-12154: TNS: the specified connection identifier could not be resolved.
错误:错误:ORA-12154:TNS:无法解析指定的连接标识符。
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:此外,如果我在数据库服务器中安装我的项目并使用 localhost 运行相同的配置,它可以正常工作:
const oracleDbConfig = {
user: "myUser",
password: "myPassword",
connectString: "localhost:1521/myDatabase",
}
Please, help me to understand the error.请帮助我理解错误。
Troubleshooting:故障排除:
dig,ping,host,nslookup
dig,ping,host,nslookup
nc -vz dbnode 1521
myDatabase
exposed in listener on dbnode? myDatabase
暴露在 dbnode 的侦听器中? dbnode>$lsnrctl status | grep myDatabase
If you can mark these tree points a success, you should be able to connect.如果您可以将这些树点标记为成功,则应该可以连接。
Best of luck.祝你好运。
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.两种方式都是有效的,但我只是让它与这个一起工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.