我需要使用 node js 使用第三方 webservice 并将其写入 oracle table .基本上我得到了获取数据的代码.基本上需要获取该输出并插入到 Oracle clob 列中.有人可以通过示例指导我.
i need to consume third party webservice using node js and write it on oracle table . basically i got the code for getting the data. Basically need to take that output and insert into a Oracle clob columns.Can someone guide me with examples.
一些资源:
https://github.com/oracle/node-oracledb/tree/master/examples 有 LOB 示例,例如 lobinsert1.js 和 lobinsert2.js
https://github.com/oracle/node-oracledb/tree/master/examples has LOB examples, for example lobinsert1.js and lobinsert2.js
node-oracledb 手册中有大量关于在 node-oracledb 中使用 LOB 的文档,请参阅 使用 CLOB、NCLOB 和 BLOB 数据.
There is plenty of documentation on using LOBs in node-oracledb in the node-oracledb manual, see Working with CLOB, NCLOB and BLOB Data.
例如:
// Insert a CLOB
const str = fs.readFileSync(clobInFileName, 'utf8');
result = await connection.execute(
`INSERT INTO no_lobs (id, c) VALUES (:id, :c)`,
{ id: 1, c: str }
);
if (result.rowsAffected != 1)
throw new Error('CLOB was not inserted');
else
console.log('CLOB inserted from ' + clobInFileName);
在您的情况下,您将从您的网络服务而不是磁盘读取 str
文件.由于我不知道该网络服务是什么,因此无法发表更多评论.
In your case you would read str
from your web service instead of a disk
file. Since I don't know what that web service is, I can't comment more.
node-oracledb 的安装说明在这里.
Installation instructions for node-oracledb are here.
这篇关于使用 Web 服务并使用 Node.js 将 CLOB 插入 Oracle 数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!