Consuming Web Service And Inserting Clob Using Node.js To Oracle Database Table
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 i
Solution 1:
Some resources:
https://github.com/oracle/node-oracledb/tree/master/examples has LOB examples, for example lobinsert1.js and lobinsert2.js
There is plenty of documentation on using LOBs in node-oracledb in the node-oracledb manual, see Working with CLOB, NCLOB and BLOB Data.
For example:
// Insert a CLOBconst 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)
thrownewError('CLOB was not inserted');
elseconsole.log('CLOB inserted from ' + clobInFileName);
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.
Installation instructions for node-oracledb are here.
Post a Comment for "Consuming Web Service And Inserting Clob Using Node.js To Oracle Database Table"