Skip to content

Commit 1d4bbec

Browse files
committed
Update ADB doc
1 parent ba118e5 commit 1d4bbec

File tree

1 file changed

+84
-23
lines changed

1 file changed

+84
-23
lines changed

doc/api.md

Lines changed: 84 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ For installation information, see the [Node-oracledb Installation Instructions][
460460
- 16.9.4 [Application Continuity](#appcontinuity)
461461
- 16.9.5 [Database Call Timeouts](#dbcalltimeouts)
462462
- 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)
464464
- 16.12 [Connecting to Sharded Databases](#sharding)
465465
17. [SQL Execution](#sqlexecution)
466466
- 17.1 [SELECT Statements](#select)
@@ -8387,7 +8387,8 @@ A wallet configuration file `cwallet.sso` for secure connection can be located
83878387
with, or separately from, the `tnsnames.ora` and `sqlnet.ora` files. It should
83888388
be securely stored. The `sqlnet.ora` file's `WALLET_LOCATION` path should be
83898389
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).
83918392

83928393
Note the [Easy Connect Plus](#easyconnect) syntax can set many common
83938394
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
1053610537
alternatively be in the application's [`sqlnet.ora`](#tnsadmin) file. The
1053710538
general recommendation for `EXPIRE_TIME` is to use a value that is slightly less
1053810539
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
1054010541
of `EXPIRE_TIME`. These settings can also aid detection of a terminated remote
1054110542
database server.
1054210543

@@ -10682,37 +10683,52 @@ Also see the technical papers [Application Checklist for Continuous Service for
1068210683
MAA Solutions][204] and [Continuous Availability Application Continuity for the
1068310684
Oracle Database][178].
1068410685

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
1068610687

1068710688
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.
1069110693

1069210694
##### Install the Wallet and Network Configuration Files
1069310695

1069410696
From the Oracle Cloud console for the database download the wallet zip file. It
1069510697
contains the wallet and network configuration files. Note: keep wallet files in
1069610698
a secure location and share them only with authorized users.
1069710699

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:
1070110702

1070210703
- `tnsnames.ora` - Maps net service names used for application connection strings to your database services
1070310704
- `sqlnet.ora` - Configures Oracle Network settings
1070410705
- `cwallet.sso` - Enables SSL/TLS connections. Note the cloud wallet does not contain a database username or password.
1070510706

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:
1070710719

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.
1071610732

1071710733
##### Run Your Application
1071810734

@@ -10732,8 +10748,8 @@ connection = await oracledb.getConnection({
1073210748
});
1073310749
```
1073410750

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.
1073710753

1073810754
If you need to create a new database schema so you do not login as the privileged
1073910755
ADMIN user, refer to the relevant Oracle Cloud documentation, for example see
@@ -10761,6 +10777,51 @@ for example:
1076110777
cjdb1_high = (description= (address=(https_proxy=myproxy.example.com)(https_proxy_port=80)(protocol=tcps)(port=1522)(host= . . .
1076210778
```
1076310779

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+
1076410825
### <a name="sharding"></a> 16.12 Connecting to Sharded Databases
1076510826

1076610827
Sharding can be used to horizontally partition data across independent
@@ -16494,7 +16555,7 @@ await collection.insertOne(mycontent);
1649416555

1649516556
## <a name="startupshutdown"></a> 31. Database Start Up and Shut Down
1649616557

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:
1649816559

1649916560
- Simple usage: [`oracledb.startup()`](#odbstartup) and [`oracledb.shutdown()`](#odbshutdown)
1650016561

@@ -17793,7 +17854,7 @@ can be asked at [AskTom][158].
1779317854
[158]: https://asktom.oracle.com/
1779417855
[159]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-6140611A-83FC-4C9C-B31F-A41FC2A5B12D
1779517856
[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
1779717858
[162]: https://www.oracle.com//cloud/free/
1779817859
[163]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-C672E92D-CE32-4759-9931-92D7960850F7
1779917860
[164]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=SHARD

0 commit comments

Comments
 (0)