@@ -460,7 +460,7 @@ For installation information, see the [Node-oracledb Installation Instructions][
460
460
- 16.9.4 [Application Continuity](#appcontinuity)
461
461
- 16.9.5 [Database Call Timeouts](#dbcalltimeouts)
462
462
- 16.10 [Connecting to Oracle Real Application Clusters (RAC)](#connectionrac)
463
- - 16.11 [Connecting to Oracle Autonomous Database ](#connectionadb)
463
+ - 16.11 [Connecting to Oracle Cloud Autonomous Databases ](#connectionadb)
464
464
- 16.12 [Connecting to Sharded Databases](#sharding)
465
465
17. [SQL Execution](#sqlexecution)
466
466
- 17.1 [SELECT Statements](#select)
@@ -8387,7 +8387,8 @@ A wallet configuration file `cwallet.sso` for secure connection can be located
8387
8387
with, or separately from, the `tnsnames.ora` and `sqlnet.ora` files. It should
8388
8388
be securely stored. The `sqlnet.ora` file's `WALLET_LOCATION` path should be
8389
8389
set to the directory containing `cwallet.sso`. For Oracle Autonomous Database
8390
- use of wallets, see [Connecting to Oracle Autonomous Database](#connectionadb).
8390
+ use of wallets, see [Connecting to Oracle Cloud Autonomous
8391
+ Databases](#connectionadb).
8391
8392
8392
8393
Note the [Easy Connect Plus](#easyconnect) syntax can set many common
8393
8394
configuration options without needing `tnsnames.ora` or `sqlnet.ora` files.
@@ -10536,7 +10537,7 @@ and to adjust keepalive timeouts. With Oracle Client 21c the setting can
10536
10537
alternatively be in the application's [`sqlnet.ora`](#tnsadmin) file. The
10537
10538
general recommendation for `EXPIRE_TIME` is to use a value that is slightly less
10538
10539
than half of the termination period. In older versions of Oracle Client, a
10539
- tnsnames.ora connect descriptor option [`ENABLE=BROKEN`][36] can be used instead
10540
+ ` tnsnames.ora` connect descriptor option [`ENABLE=BROKEN`][36] can be used instead
10540
10541
of `EXPIRE_TIME`. These settings can also aid detection of a terminated remote
10541
10542
database server.
10542
10543
@@ -10682,37 +10683,52 @@ Also see the technical papers [Application Checklist for Continuous Service for
10682
10683
MAA Solutions][204] and [Continuous Availability Application Continuity for the
10683
10684
Oracle Database][178].
10684
10685
10685
- ### <a name="connectionadb"></a> 16.11 Connecting to Oracle Autonomous Database
10686
+ ### <a name="connectionadb"></a> 16.11 Connecting to Oracle Cloud Autonomous Databases
10686
10687
10687
10688
To enable connection to Oracle Autonomous Database in Oracle Cloud, a wallet
10688
- needs be downloaded from the cloud GUI, and node-oracledb needs to be configured
10689
- to use it. A database username and password is still required. The wallet only
10690
- enables SSL/TLS.
10689
+ needs be downloaded from the cloud, and node-oracledb needs to be configured to
10690
+ use it. The wallet gives mutual TLS which provides enhanced security for
10691
+ authentication and encryption. A database username and password is still
10692
+ required for your application connections.
10691
10693
10692
10694
##### Install the Wallet and Network Configuration Files
10693
10695
10694
10696
From the Oracle Cloud console for the database download the wallet zip file. It
10695
10697
contains the wallet and network configuration files. Note: keep wallet files in
10696
10698
a secure location and share them only with authorized users.
10697
10699
10698
- Unzip the wallet zip file.
10699
-
10700
- For node-oracledb, only these files from the zip are needed:
10700
+ Unzip the wallet zip file. For node-oracledb, only these files from the zip
10701
+ are needed:
10701
10702
10702
10703
- `tnsnames.ora` - Maps net service names used for application connection strings to your database services
10703
10704
- `sqlnet.ora` - Configures Oracle Network settings
10704
10705
- `cwallet.sso` - Enables SSL/TLS connections. Note the cloud wallet does not contain a database username or password.
10705
10706
10706
- The other files and the wallet password are not needed.
10707
+ There are now two options:
10708
+
10709
+ - Move the three files to the `network/admin` directory of the client libraries
10710
+ used by your application. For example if you are using Instant Client 19c
10711
+ and it is in `$HOME/instantclient_19_11`, then you would put the wallet files
10712
+ in `$HOME/instantclient_19_11/network/admin/`.
10713
+
10714
+ - Alternatively, move them to any accessible directory, for example
10715
+ `/opt/OracleCloud/MYDB`.
10716
+
10717
+ Then edit `sqlnet.ora` and change the wallet location directory to the
10718
+ directory containing the `cwallet.sso` file. For example:
10707
10719
10708
- Place these files as shown in [Optional Oracle Net Configuration](#tnsadmin).
10709
- The `sqlnet.ora` file contains a `WALLET_LOCATION` path to the directory where
10710
- `cwallet.sso` will be read from. By default this path is `"?/network/admin"`.
10711
- This path maps to the `network/admin` subdirectory of Oracle Instant Client , or
10712
- to the `$ORACLE_HOME/network/admin` subdirectory (when node-oracledb is linked
10713
- with the client libraries from a full client or database installation). If
10714
- `cwallet.sso` is in a different location, then you will need to edit the path in
10715
- `sqlnet.ora` and set it to the directory containing `cwallet.sso`.
10720
+ ```
10721
+ WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="/opt/OracleCloud/MYDB")))
10722
+ SSL_SERVER_DN_MATCH=yes
10723
+ ```
10724
+
10725
+ Since the `tnsnames.ora` and `sqlnet.ora` files are not in the default
10726
+ location, your application needs to indicate where they are, either with the
10727
+ [`configDir`](#odbinitoracleclientattrsopts) parameter to
10728
+ [`initOracleClient()`](#odbinitoracleclient), or using the `TNS_ADMIN`
10729
+ environment variable. See [Optional Oracle Net Configuration](#tnsadmin).
10730
+ Neither of these settings are needed, and you don't need to edit
10731
+ `sqlnet.ora`, if you have put all the files in the `network/admin` directory.
10716
10732
10717
10733
##### Run Your Application
10718
10734
@@ -10732,8 +10748,8 @@ connection = await oracledb.getConnection({
10732
10748
});
10733
10749
```
10734
10750
10735
- Once you have set Oracle environment variables required by your application,
10736
- such as `ORA_SDTZ` or `TNS_ADMIN`, you can start your application.
10751
+ Once you have set optional Oracle environment variables required by your
10752
+ application, such as `ORA_SDTZ` or `TNS_ADMIN`, you can start your application.
10737
10753
10738
10754
If you need to create a new database schema so you do not login as the privileged
10739
10755
ADMIN user, refer to the relevant Oracle Cloud documentation, for example see
@@ -10761,6 +10777,51 @@ for example:
10761
10777
cjdb1_high = (description= (address=(https_proxy=myproxy.example.com)(https_proxy_port=80)(protocol=tcps)(port=1522)(host= . . .
10762
10778
```
10763
10779
10780
+ ##### Using the Easy Connect Syntax with Autonomous Database
10781
+
10782
+ When node-oracledb is using Oracle Client libraries 19c or later, you can
10783
+ optionally use the [Easy Connect](#easyconnect) syntax to connect to Oracle
10784
+ Autonomous Database.
10785
+
10786
+ The mapping from a cloud `tnsnames.ora` entry to an Easy Connect Plus string
10787
+ is:
10788
+
10789
+ ```
10790
+ protocol://host:port/service_name?wallet_location=/my/dir&retry_count=N&retry_delay=N
10791
+ ```
10792
+
10793
+ For example, if your `tnsnames.ora` file had an entry:
10794
+
10795
+ ```
10796
+ cjjson_high = (description=(retry_count=20)(retry_delay=3)
10797
+ (address=(protocol=tcps)(port=1522)
10798
+ (host=adb.ap-sydney-1.oraclecloud.com))
10799
+ (connect_data=(service_name=abc_cjjson_high.adb.oraclecloud.com))
10800
+ (security=(ssl_server_cert_dn="CN=adb.ap-sydney-1.oraclecloud.com,OU=Oracle ADB SYDNEY,O=Oracle Corporation,L=Redwood City,ST=California,C=US")))
10801
+ ```
10802
+
10803
+ Then your applications can connect using the connection string:
10804
+
10805
+ ```javascript
10806
+ cs = "tcps://adb.ap-sydney-1.oraclecloud.com:1522/abc_cjjson_high.adb.oraclecloud.com?wallet_location=/Users/cjones/Cloud/CJJSON&retry_count=20&retry_delay=3"
10807
+ connection = await oracledb.getConnection({
10808
+ user : "hr",
10809
+ password : mypw,
10810
+ connectString : cs
10811
+ });
10812
+ ```
10813
+
10814
+ The `wallet_location` parameter needs to be set to the directory containing the
10815
+ `cwallet.sso` file from the wallet ZIP. The other wallet files, including
10816
+ `tnsnames.ora`, are not needed when you use the Easy Connect Plus syntax.
10817
+
10818
+ You can optionally add other Easy Connect parameters to the connection string,
10819
+ for example:
10820
+
10821
+ ```javascript
10822
+ cs = cs + "&https_proxy=myproxy.example.com&https_proxy_port=80"
10823
+ ```
10824
+
10764
10825
### <a name="sharding"></a> 16.12 Connecting to Sharded Databases
10765
10826
10766
10827
Sharding can be used to horizontally partition data across independent
@@ -16494,7 +16555,7 @@ await collection.insertOne(mycontent);
16494
16555
16495
16556
## <a name="startupshutdown"></a> 31. Database Start Up and Shut Down
16496
16557
16497
- There are two groups of database start up and shut down functions::
16558
+ There are two groups of database start up and shut down functions:
16498
16559
16499
16560
- Simple usage: [`oracledb.startup()`](#odbstartup) and [`oracledb.shutdown()`](#odbshutdown)
16500
16561
@@ -17793,7 +17854,7 @@ can be asked at [AskTom][158].
17793
17854
[158]: https://asktom.oracle.com/
17794
17855
[159]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-6140611A-83FC-4C9C-B31F-A41FC2A5B12D
17795
17856
[160]: https://github.com/oracle/node-oracledb/issues/699#issuecomment-524009129
17796
- [161]: https://docs.oracle.com/en/cloud/paas/atp-cloud/atpud /managing-database-users.html
17857
+ [161]: https://docs.oracle.com/en/cloud/paas/autonomous-database/adbdu /managing-database-users.html#GUID-5B94EA60-554A-4BA4-96A3-1D5A3ED5878D
17797
17858
[162]: https://www.oracle.com//cloud/free/
17798
17859
[163]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-C672E92D-CE32-4759-9931-92D7960850F7
17799
17860
[164]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=SHARD
0 commit comments