You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The directory in node-oracledb's [Github repository](https://github.com/oracle/node-oracledb/tree/main/examples) contains a lot of [node-oracledb](https://www.npmjs.com/package/oracledb) examples.
4
+
Documentation is [here](https://node-oracledb.readthedocs.io/en/latest/).
-Edit `dbconfig.js` and set your username and the database connection string,
12
-
for example:
10
+
-Ensure that you navigate to the `examples` directory in your terminal window
11
+
or IDE, where you are running the samples.
13
12
14
-
```
15
-
module.exports = {
16
-
user: "hr",
17
-
password: process.env.NODE_ORACLEDB_PASSWORD,
18
-
connectString:"localhost/orclpdb1"
19
-
};
13
+
- Review `dbconfig.js`.
20
14
21
-
```
15
+
In your terminal window or IDE, set the following environment variables to
16
+
provide credentials for the `dbconfig.js` file.
17
+
18
+
-`NODE_ORACLEDB_USER` must be set to the database user.
19
+
20
+
-`NODE_ORACLEDB_PASSWORD` must be set to the database password.
21
+
22
+
-`NODE_ORACLEDB_CONNECTIONSTRING` must be set to the connection string that points to your database's location.
22
23
23
-
- In a terminal window, set the environment variable `NODE_ORACLEDB_PASSWORD` to
24
-
the value of your database password.
24
+
-`NODE_ORACLEDB_EXTERNALAUTH` provides the options for enabling external authentication. Setting this environment variable to "true" will enable external authentication. To ensure external authentication works, firstly make sure the Oracle external authentication service is correctly configured. See [Documentation for External Authentication](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#extauth) for details.
25
25
26
-
- Review the samples and then run them individually. For example, to see what
26
+
-`NODE_ORACLEDB_DRIVER_MODE` provides an option to set the 'Thin' or 'Thick' modes of node-oracledb. Setting this environment variable to "thick" will enable Thick mode.
27
+
Setting it to "thin" will retain the Thin mode. The default mode is Thin.
28
+
29
+
-`NODE_ORACLEDB_WALLET_LOCATION` must be set to the local directory name for the wallets that may be required for mutual TLS (mTLS) connections, especially to Oracle Cloud
30
+
Autonomous Databases optionally. The wallet location can also be provided as a part of the database connect string.
31
+
32
+
-`NODE_ORACLEDB_WALLET_PASSWORD` must set to the password for the wallets that may be required for mutual TLS (mTLS) connections, especially to Oracle Cloud Autonomous Databases.
33
+
34
+
-`NODE_ORACLEDB_CLIENT_LIB_DIR` provides an optional path for the Oracle Client libraries to be used on Windows and macOS platforms, when using Thick mode in node-oracledb.
35
+
36
+
Review the examples and then run them individually. For example, to see what
27
37
the file `example.js` does, use:
28
38
29
39
```
30
40
node example.js
31
41
```
32
42
33
-
-After running examples, the demonstration objects can be dropped with
43
+
After running the examples, the demonstration objects can be dropped with
34
44
`demodrop.js`:
35
45
36
46
```
37
47
node demodrop.js
38
48
```
39
49
50
+
Many examples can be run in either node-oracledb Thin (the default) or Thick
51
+
modes. Thin mode is a pure JavaScript implementation of node-oracledb.
52
+
Setting the environment variable `NODE_ORACLEDB_DRIVER_MODE` to `'thick'` will
53
+
make examples use Thick mode.
54
+
40
55
## Example Overview
41
56
42
57
If this is your first time with node-oracledb, start with
@@ -48,13 +63,15 @@ File Name | Description
48
63
[`aqobject.js`](aqobject.js) | Oracle Advanced Queuing (AQ) example passing an Oracle Database object
49
64
[`aqoptions.js`](aqoptions.js) | Oracle Advanced Queuing (AQ) example setting options and message attributes
50
65
[`aqraw.js`](aqraw.js) | Basic Oracle Advanced Queuing (AQ) example passing text messages
66
+
[`aqutil.js`](aqutil.js) | Common file to setup the user credentials for all the Advanced Queuing (AQ) examples.
51
67
[`blobhttp.js`](blobhttp.js) | Simple web app that streams an image
52
68
[`calltimeout.js`](calltimeout.js) | Shows how to cancel a SQL statement if it doesn't complete in a specified time
53
69
[`connect.js`](connect.js) | Basic example for creating a standalone (non-pooled) connection
54
70
[`connectionpool.js`](connectionpool.js) | Basic example creating a pool of connections
55
71
[`cqn1.js`](cqn1.js) | Basic Continuous Query Notification (CQN) example
56
72
[`cqn2.js`](cqn2.js) | Continuous Query Notification with notification grouping
57
-
[`date.js`](date.js) | Show some DATE and TIMESTAMP behaviors
73
+
[`date_timestamp1.js`](date_timestamp1.js) | Show some basic DATE and TIMESTAMP behaviors
74
+
[`date_timestamp2.js`](date_timestamp2.js) | Show some DATE and TIMESTAMP behaviors with timezones
58
75
[`dbconfig.js`](dbconfig.js) | Common file used by examples for setting connection credentials
59
76
[`dbmsoutputgetline.js`](dbmsoutputgetline.js) | Show fetching DBMS_OUTPUT by binding buffers
60
77
[`dbmsoutputpipe.js`](dbmsoutputpipe.js) | Show fetching DBMS_OUTPUT by using a pipelined table
@@ -70,7 +87,6 @@ File Name | Description
70
87
[`em_rowcounts.js`](em_rowcounts.js) | `executeMany()` example showing how to find the number of rows affected by each input row
71
88
[`endtoend.js`](endtoend.js) | Example showing setting tracing attributes
72
89
[`example.js`](example.js) | Basic example showing creating a table, inserting multiple rows, and querying rows
73
-
[`fetchinfo.js`](fetchinfo.js) | Show how numbers and dates can be returned as strings using `fetchAsString` and `fetchInfo`
0 commit comments