Skip to content

Commit a9fef73

Browse files
committed
Updates the examples in the examples directory
1 parent 23530ce commit a9fef73

File tree

5 files changed

+41
-30
lines changed

5 files changed

+41
-30
lines changed

examples/connectionpool.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,18 @@
4444

4545
Error.stackTraceLimit = 50;
4646

47-
// If you increase poolMax, you must increase UV_THREADPOOL_SIZE before Node.js
48-
// starts its thread pool. If you set UV_THREADPOOL_SIZE too late, the value is
49-
// ignored and the default size of 4 is used.
50-
// Note on Windows you must set the UV_THREADPOOL_SIZE environment variable before
51-
// running your application.
52-
// process.env.UV_THREADPOOL_SIZE = 4;
47+
// Note: if you use Thick mode, and you increase poolMax, then you must also
48+
// increase UV_THREADPOOL_SIZE before Node.js starts its thread pool. If you
49+
// set UV_THREADPOOL_SIZE too late, the value is ignored and the default size
50+
// of 4 is used.
51+
//
52+
// On Windows you must set the UV_THREADPOOL_SIZE environment variable
53+
// externally before running your application.
54+
//
55+
// Increasing UV_THREADPOOL_SIZE is not needed if you use Thin mode.
56+
//
57+
// process.env.UV_THREADPOOL_SIZE = 10; // set threadpool size to 10 for 10 connections
58+
5359

5460
const oracledb = require('oracledb');
5561
const dbConfig = require('./dbconfig.js');
@@ -89,7 +95,7 @@ async function init() {
8995
// homogeneous: true, // all connections in the pool have the same credentials
9096
// poolAlias: 'default', // set an alias to allow access to the pool via a name.
9197
// poolIncrement: 1, // only grow the pool by one connection at a time
92-
// poolMax: 4, // maximum size of the pool. Increase UV_THREADPOOL_SIZE if you increase poolMax
98+
// poolMax: 4, // maximum size of the pool. (Note: Increase UV_THREADPOOL_SIZE if you increase poolMax in Thick mode)
9399
// poolMin: 0, // start with no connections; let the pool shrink completely
94100
// poolPingInterval: 60, // check aliveness of connection if idle in the pool for 60 seconds
95101
// poolTimeout: 60, // terminate connections that are idle in the pool for 60 seconds

examples/example.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ async function run() {
127127
// For a complete list of options see the documentation.
128128
options = {
129129
outFormat: oracledb.OUT_FORMAT_OBJECT, // query result format
130-
// extendedMetaData: true, // get extra metadata
131130
// fetchArraySize: 100 // internal buffer allocation size for tuning
132131
};
133132

examples/select1.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ async function run() {
9090
{
9191
maxRows: 1
9292
//, outFormat: oracledb.OUT_FORMAT_OBJECT // query result format
93-
//, extendedMetaData: true // get extra metadata
9493
//, fetchArraySize: 100 // internal buffer allocation size for tuning
9594
});
9695

examples/version.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,23 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
5858
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
5959
}
6060

61-
console.log("Run at: " + new Date());
62-
console.log("Node.js version: " + process.version + " (" + process.platform, process.arch + ")");
63-
64-
console.log("Node-oracledb version:", oracledb.versionString); // version (including the suffix)
65-
// console.log("Node-oracledb version:", oracledb.version); // numeric version format is useful for comparisons
66-
// console.log("Node-oracledb version suffix:", oracledb.versionSuffix); // e.g. "-beta.1", or empty for production releases
67-
68-
if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
69-
console.log("Oracle Client library version:", oracledb.oracleClientVersionString);
70-
// console.log("Oracle Client library version:", oracledb.oracleClientVersion); // numeric version format
71-
}
7261

62+
// Get the database version and check the driver mode
7363
async function run() {
7464

7565
let connection;
7666

7767
try {
7868
connection = await oracledb.getConnection(dbConfig);
7969

80-
console.log("Oracle Database version:", connection.oracleServerVersionString);
81-
// console.log("Oracle Database version:", connection.oracleServerVersion); // numeric version format
70+
console.log("Oracle Database version : ", connection.oracleServerVersionString);
71+
// console.log("Oracle Database version : ", connection.oracleServerVersion); // numeric version format
8272

8373
const result = await connection.execute(
8474
`SELECT UNIQUE CLIENT_DRIVER
8575
FROM V$SESSION_CONNECT_INFO
8676
WHERE SID = SYS_CONTEXT('USERENV', 'SID')`);
87-
console.log(result.rows[0][0]);
77+
console.log("CLIENT_DRIVER : " + result.rows[0][0] + "'");
8878

8979
} catch (err) {
9080
console.error(err);
@@ -99,4 +89,16 @@ async function run() {
9989
}
10090
}
10191

92+
console.log("Run at : " + new Date());
93+
console.log("Node.js version : " + process.version + " (" + process.platform, process.arch + ")");
94+
95+
console.log("Node-oracledb version : ", oracledb.versionString); // version (including the suffix)
96+
// console.log("Node-oracledb version : ", oracledb.version); // numeric version format is useful for comparisons
97+
// console.log("Node-oracledb version suffix : ", oracledb.versionSuffix); // e.g. "-beta.1", or empty for production releases
98+
99+
if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
100+
console.log("Oracle Client library version : ", oracledb.oracleClientVersionString);
101+
// console.log("Oracle Client library version : ", oracledb.oracleClientVersion); // numeric version format
102+
}
103+
102104
run();

examples/webapp.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,18 @@
4343

4444
Error.stackTraceLimit = 50;
4545

46-
// If you increase poolMax, you must increase UV_THREADPOOL_SIZE before Node.js
47-
// starts its thread pool. If you set UV_THREADPOOL_SIZE too late, the value is
48-
// ignored and the default size of 4 is used.
49-
// process.env.UV_THREADPOOL_SIZE = 10; // set threadpool size to 10
46+
// Note: if you use Thick mode, and you increase poolMax, then you must also
47+
// increase UV_THREADPOOL_SIZE before Node.js starts its thread pool. If you
48+
// set UV_THREADPOOL_SIZE too late, the value is ignored and the default size
49+
// of 4 is used.
5050
//
51-
// Note on Windows you must set the UV_THREADPOOL_SIZE environment variable before
52-
// running your application.
51+
// On Windows you must set the UV_THREADPOOL_SIZE environment variable
52+
// externally before running your application.
53+
//
54+
// Increasing UV_THREADPOOL_SIZE is not needed if you use Thin mode.
55+
//
56+
// process.env.UV_THREADPOOL_SIZE = 10; // set threadpool size to 10 for 10 connections
57+
5358

5459
const http = require('http');
5560
const oracledb = require('oracledb');
@@ -97,7 +102,7 @@ async function init() {
97102
// homogeneous: true, // all connections in the pool have the same credentials
98103
// poolAlias: 'default', // set an alias to allow access to the pool via a name.
99104
// poolIncrement: 1, // only grow the pool by one connection at a time
100-
// poolMax: 4, // maximum size of the pool. Increase UV_THREADPOOL_SIZE if you increase poolMax
105+
// poolMax: 4, // maximum size of the pool. (Note: increase UV_THREADPOOL_SIZE if you increase poolMax in Thick mode)
101106
// poolMin: 0, // start with no connections; let the pool shrink completely
102107
// poolPingInterval: 60, // check aliveness of connection if idle in the pool for 60 seconds
103108
// poolTimeout: 60, // terminate connections that are idle in the pool for 60 seconds

0 commit comments

Comments
 (0)