Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions javascript/node-oracledb/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Node-oracledb Examples

This directory contains [node-oracledb](https://www.npmjs.com/package/oracledb)
examples. Documentation is [here
](https://oracle.github.io/node-oracledb/doc/api.html).
examples. Documentation is
[here](https://oracle.github.io/node-oracledb/doc/api.html).

To run the examples:

Expand All @@ -23,13 +23,15 @@ for example:
- In a terminal window, set the environment variable `NODE_ORACLEDB_PASSWORD` to
the value of your database password.

- Review the samples and then run them like:
- Review the samples and then run them individually. For example, to see what
the file `example.js` does, use:

```
node example.js
```

- After running example, the demonstration objects can be dropped with `demodrop.js`:
- After running examples, the demonstration objects can be dropped with
`demodrop.js`:

```
node demodrop.js
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/aqmulti.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -38,10 +39,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

const queueName = "DEMO_RAW_QUEUE";
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/aqobject.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -39,10 +40,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

const queueName = "ADDR_QUEUE";
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/aqoptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -38,10 +39,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

const queueName = "DEMO_RAW_QUEUE";
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/aqraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -38,10 +39,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

const queueName = "DEMO_RAW_QUEUE";
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/blobhttp.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*
*****************************************************************************/

const fs = require('fs');
const url = require('url');
const http = require('http');
const oracledb = require('oracledb');
Expand All @@ -40,10 +41,14 @@ const demoSetup = require('./demosetup.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

const httpPort = 7000;
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/calltimeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require("oracledb");
const dbConfig = require('./dbconfig.js');

Expand All @@ -37,10 +38,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

const dboptime = 4; // seconds the simulated database operation will take
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

'use strict';

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -38,10 +39,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

async function run() {
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/connectionpool.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
// running your application.
// process.env.UV_THREADPOOL_SIZE = 4;

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -50,10 +51,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

async function init() {
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/cqn1.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require("oracledb");
const dbConfig = require('./dbconfig.js');

Expand All @@ -44,10 +45,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

dbConfig.events = true; // CQN needs events mode
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/cqn2.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require("oracledb");
const dbConfig = require('./dbconfig.js');

Expand All @@ -45,10 +46,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

dbConfig.events = true; // CQN needs events mode
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
// Using a fixed Oracle time zone helps avoid machine and deployment differences
process.env.ORA_SDTZ = 'UTC';

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -40,10 +41,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

oracledb.outFormat = oracledb.OUT_FORMAT_OBJECT;
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/dbmsoutputgetline.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -35,10 +36,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

async function run() {
Expand Down
13 changes: 9 additions & 4 deletions javascript/node-oracledb/dbmsoutputpipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*
*****************************************************************************/

const fs = require('fs');
const oracledb = require('oracledb');
const dbConfig = require('./dbconfig.js');

Expand All @@ -33,10 +34,14 @@ const dbConfig = require('./dbconfig.js');
// the system library search path must always be set before Node.js is started.
// See the node-oracledb installation documentation.
// If the search path is not correct, you will get a DPI-1047 error.
if (process.platform === 'win32') { // Windows
oracledb.initOracleClient({ libDir: 'C:\\oracle\\instantclient_19_11' });
} else if (process.platform === 'darwin') { // macOS
oracledb.initOracleClient({ libDir: process.env.HOME + '/Downloads/instantclient_19_8' });
let libPath;
if (process.platform === 'win32') { // Windows
libPath = 'C:\\oracle\\instantclient_19_12';
} else if (process.platform === 'darwin') { // macOS
libPath = process.env.HOME + '/Downloads/instantclient_19_8';
}
if (libPath && fs.existsSync(libPath)) {
oracledb.initOracleClient({ libDir: libPath });
}

async function run() {
Expand Down
Loading