如何使用 node-oracledb 连接到 LDAP 服务器?

2022-01-17 00:00:00 ldap oracle node-oracledb

我有一个数据库,我可以使用字符串jdbc:oracle:thin@ldap://SERVER_NAME:1234/SERVICE,cn=OracleContext,dc-world"连接到使用 jdbc.

I have a database that I can connect to using jdbc using the string "jdbc:oracle:thin@ldap://SERVER_NAME:1234/SERVICE,cn=OracleContext,dc-world".

但是,当我使用node-oracledb时,这个连接字符串不起作用,大概是因为Node没有使用jdbc.我可以使用什么连接字符串来连接数据库?

However, when I use node-oracledb, this connection string does not work, presumably because Node doesn't use jdbc. What connection string could I use to connect to the database?

推荐答案

没有Easy Connect"可用于 LDAP 的语法,因此您将需要配置 ldap.ora 和 sqlnet.ora 文件并使用非 Easy Connectnode-oracledb 中的字符串别名(或其他工具,如 SQL*Plus、PHP OCI8、Python cx_Oracle、Golang godror 等).

There is no "Easy Connect" syntax available for LDAP so you will need to configure ldap.ora and sqlnet.ora files and use a non-Easy Connect string alias in node-oracledb (or in other tools like SQL*Plus, PHP OCI8, Python cx_Oracle, Golang godror etc).

有人告诉我(!)步骤是:

I'm told (!) the steps are:

  1. 调用 netca ->目录使用

  1. Invoke netca -> Directory Usage

通过 netca 配置命名以使用 LDAP->命名方法配置.这将为名称查找设置 sqlnet.ora.

Configure naming to use LDAP by netca->Naming Methods Configuration. This sets up sqlnet.ora for name lookup.

运行 netmgr 设置 ldap 条目或企业管理器设置 ldap.

run netmgr to setup the entry in ldap or Enterprise Manager to setup ldap.

将这些文件复制到运行 Node.js 的机器上的子目录中,并将 TNS_ADMIN 设置为包含这些文件的目录.使用 Instant Client,您可以将其放在 Instant Client 库下的 networkadmin 子目录中.请参阅手动条目 可选 Oracle 网络配置

Copy those files to a subdirectory on the machine where you run Node.js, and set TNS_ADMIN to the directory containing the files. With Instant Client you can put it in the networkadmin subdirectory under the Instant Client libraries. See the manaul entry Optional Oracle Net Configuration

将 node-oracledb 的 connectString 设置为 3 中配置的连接别名,例如兽人"

Set node-oracledb's connectString to the connect alias configured in 3, e.g. "orcl"

相关文章