简体   繁体   English

通过EC2上的节点OracleDB模块连接到OracleDB

[英]Connecting to OracleDB via Node OracleDB module on EC2

I'm having trouble getting a connection established to my OracleDB that resides on a different system. 我无法建立与我的OracleDB建立的连接,该连接位于不同的系统上。 From what I've learned from the Oracledb Node module Documentation , the connection setup should look like this: 根据我从Oracledb Node模块文档中学到的知识 ,连接设置应如下所示:

oracledb.getConnection(
  {
    user          : "hr",
    password      : "welcome",
    connectString : "localhost/XE"
  }
  //fun querying goes here

I've reviewed the oracledb module documentation, however I cannot seem to find the syntax by which I need to follow when given certain variables. 我已经回顾了oracledb模块文档,但是在给定某些变量时,我似乎无法找到我需要遵循的语法。 In order for me to secure a connection to the DB, I need to provide on the connection: 为了让我确保与DB的连接,我需要提供连接:

dbUserID: blah blah (maps to 'user' in Object),
dbPassword: Blahblahblah (maps to 'password' in Object),
oraclePort: (1521 as standard, but not sure where this goes in the object),
dbHostName: db.server.com (maps to 'localhost' in Object),
dbInstance: DBINSTANCENAME (not sure where this goes in object)

I'm fairly certain the hostname, port and instance are to be used in the 'connectString' section of the object, however I'm unsure how it should be formatted. 我很确定主机名,端口和实例将在对象的'connectString'部分中使用,但是我不确定它应该如何格式化。

Any help and suggestions on how I might go about getting myself connected would be greatly appreciated! 任何有关如何让自己联系的帮助和建议将不胜感激!

EDIT: Im also receiving this error when the server is started up for the first time: [Error: ORA-12162: TNS:net service name is incorrectly specified] I thought I had solved this error but apparently I have not! 编辑:我也是第一次启动服务器时收到此错误: [Error: ORA-12162: TNS:net service name is incorrectly specified]我以为我已经解决了这个错误,但显然我没有! Any suggestions would be appreciated. 任何建议,将不胜感激。

Try the following: 请尝试以下方法:

   oracledb.getConnection(
      {
        user          : "hr",
        password      : "welcome",
        connectString : "db.server.com:1521/DBINSTANCENAME"
      }

Use 'lsnrctl services' on the DB server to check the service names available. 使用数据库服务器上的“lsnrctl services”检查可用的服务名称。 The "Easy Connect" syntax uses the service name, not an instance name. “Easy Connect”语法使用服务名称,而不是实例名称。

Check you have the right ports open. 检查您是否打开了正确的端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM