Node-oracledb: Querying Lob columns gives an object instead of data

Created on 9 May 2019  路  4Comments  路  Source: oracle/node-oracledb

Hi,

I successfully pulling and writing data from and to the Oracle database. I need to extract data of a Lob object (Large Object). When you I the SQL query in the Oracle SQL Developer desktop application I get the text representation of the data, however, this is what I get using node-oracledb:

Lob {
    _readableState:
     ReadableState {
       objectMode: false,
       highWaterMark: 16384,
       buffer: BufferList { head: null, tail: null, length: 0 },
       length: 0,
       pipes: null,
       pipesCount: 0,
       flowing: null,
       ended: false,
       endEmitted: false,
       reading: false,
       sync: true,
       needReadable: false,
       emittedReadable: false,
       readableListening: false,
       resumeScheduled: false,
       paused: true,
       emitClose: true,
       autoDestroy: false,
       destroyed: false,
       defaultEncoding: 'utf8',
       awaitDrain: 0,
       readingMore: false,
       decoder: null,
       encoding: null },
    readable: true,
    _events: [Object: null prototype] { finish: [Function] },
    _eventsCount: 1,
    _maxListeners: undefined,
    _writableState:
     WritableState {
       objectMode: false,
       highWaterMark: 16384,
       finalCalled: false,
       needDrain: false,
       ending: false,
       ended: false,
       finished: false,
       destroyed: false,
       decodeStrings: true,
       defaultEncoding: 'utf8',
       length: 0,
       writing: false,
       corked: 0,
       sync: true,
       bufferProcessing: false,
       onwrite: [Function: bound onwrite],
       writecb: null,
       writelen: 0,
       bufferedRequest: null,
       lastBufferedRequest: null,
       pendingcb: 0,
       prefinished: false,
       errorEmitted: false,
       emitClose: true,
       autoDestroy: false,
       bufferedRequestCount: 0,
       corkedRequestsFree: [Object] },
    writable: true,
    allowHalfOpen: true,
    iLob:
     ILob {
       valid: true,
       autoCloseLob: true,
       type: 2006,
       offset: 1,
       pieceSize: 8132,
       length: 15,
       chunkSize: 8132 },
    close: [Function] }

My question is how to extract the data/text form this Lob object.

Thanks.

What is your Node.js version: use console.log(process.version)? Is it 64-bit or 32-bit: use console.log(process.arch)?
x64
undefined

What is your node-oracledb version: use console.log(oracledb.versionString)?
3.1.2

What error(s) you are seeing?
undefined

What OS (and version) is Node.js executing on: use console.log(process.platform)?
win32

What is your Oracle client (e.g. Instant Client) version: use console.log(oracledb.oracleClientVersionString)? Is it 64-bit or 32-bit? How was it installed? Where is it installed?
18.3.0.0.0

What is your Oracle Database version: use console.log(connection.oracleServerVersionString)?
11.2.0.4.0

What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to? On macOS, what is in ~/lib?
C:\oracle\instantclient_18_3

  1. What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to? On macOS, what is in ~/lib?

  2. What Oracle environment variables did you set? How exactly did you set them?

  3. Do you have a small, single Node.js script that immediately runs to show us the problem?

question

All 4 comments

Please read the manual. Thanks!

Thanks! I got it working.

Hey, we had this same problem with LOB datatypes.

It turned out we had an older version of oracleDB that needed to be updated.

All we needed to do to fix it was an npm install

@keanedawg that makes sense. The first versions of node-oracledb only had support for Lob streaming.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xpro666 picture xpro666  路  3Comments

ChrisHAdams picture ChrisHAdams  路  3Comments

sibelius picture sibelius  路  4Comments

tbyoran picture tbyoran  路  4Comments

sanfords picture sanfords  路  3Comments