Skip to content

Commit 0d0afe6

Browse files
committed
Add a section on connecting to Autonomous DB
1 parent 52ff5fd commit 0d0afe6

File tree

1 file changed

+80
-3
lines changed

1 file changed

+80
-3
lines changed

doc/api.md

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ For installation information, see the [Node-oracledb Installation Instructions][
388388
- 14.9.1 [Fast Application Notification (FAN)](#connectionfan)
389389
- 14.9.2 [Runtime Load Balancing (RLB)](#connectionrlb)
390390
- 14.9.3 [Database Call Timeouts](#dbcalltimeouts)
391+
- 14.10 [Connecting to Oracle Autonomous Database](#connectionadb)
391392
15. [SQL Execution](#sqlexecution)
392393
- 15.1 [SELECT Statements](#select)
393394
- 15.1.1 [Fetching Rows with Direct Fetches](#fetchingrows)
@@ -8584,6 +8585,78 @@ Users of pre-Oracle 18c client libraries can set call timeouts by
85848585
setting [`SQLNET.RECV_TIMEOUT`][34] and [`SQLNET.SEND_TIMEOUT`][35] in
85858586
a [`sqlnet.ora` file](#tnsadmin).
85868587

8588+
### <a name="connectionadb"></a> 14.10 Connecting to Oracle Autonomous Database
8589+
8590+
To enable connection to Oracle Autonomous Database in Oracle Cloud, a wallet
8591+
needs be downloaded from the cloud GUI, and node-oracledb needs to be configured
8592+
to use it. A database username and password is still required. The wallet only
8593+
enables SSL/TLS.
8594+
8595+
##### Install the Wallet and Network Configuration Files
8596+
8597+
From the Oracle Cloud console for the database download the wallet zip file. It
8598+
contains the wallet and network configuration files. Note: keep wallet files in
8599+
a secure location and share them only with authorized users.
8600+
8601+
Unzip the wallet zip file.
8602+
8603+
For node-oracledb, only these files from the zip are needed:
8604+
8605+
- `tnsnames.ora` - Maps net service names used for application connection strings to your database services
8606+
- `sqlnet.ora` - Configures Oracle Network settings
8607+
- `cwallet.sso` - Enables SSL/TLS connections
8608+
8609+
The other files and the wallet password are not needed.
8610+
8611+
Place these files as shown in [Optional Oracle Net Configuration](#tnsadmin).
8612+
8613+
##### Run Your Application
8614+
8615+
The `tnsnames.ora` file contains net service names for various levels of
8616+
database service. For example, if you create a database called CJDB1 with the
8617+
Always Free services from the [Oracle Cloud Free Tier][162], then you might
8618+
decide to use the connection string in `tnsnames.ora` called `cjdb1_high`.
8619+
8620+
Update your application to use your schema username, its database password, and
8621+
a net service name, for example:
8622+
8623+
```javascript
8624+
connection = await oracledb.getConnection({
8625+
user: "scott",
8626+
password: mypw, // mypw contains the scott schema password
8627+
connectString: "cjdb1_high"
8628+
});
8629+
```
8630+
8631+
Once you have set Oracle environment variables required by your application,
8632+
such as `ORA_SDTZ` or `TNS_ADMIN`, you can start your application.
8633+
8634+
If you need to create a new database schema so you do not login as the privileged
8635+
ADMIN user, refer to the relevant Oracle Cloud documentation, for example see
8636+
[Create Database Users][161] in the Oracle Autonomous Transaction Processing
8637+
Dedicated Deployments manual.
8638+
8639+
##### Access Through a Proxy
8640+
8641+
If you are behind a firewall, you can tunnel TLS/SSL connections via a proxy
8642+
using [HTTPS_PROXY][163] in the connect descriptor. Successful connection
8643+
depends on specific proxy configurations. Oracle does not recommend doing this
8644+
when performance is critical.
8645+
8646+
Edit `sqlnet.ora` and add a line:
8647+
8648+
```
8649+
SQLNET.USE_HTTPS_PROXY=on
8650+
```
8651+
8652+
Edit `tnsnames.ora` and add an `HTTPS_PROXY` proxy name and `HTTPS_PROXY_PORT`
8653+
port to the connect descriptor address list of any service name you plan to use,
8654+
for example:
8655+
8656+
```
8657+
cjdb1_high = (description= (address=(https_proxy=myproxy.example.com)(https_proxy_port=80)(protocol=tcps)(port=1522)(host= . . .
8658+
```
8659+
85878660
## <a name="sqlexecution"></a> 15. SQL Execution
85888661

85898662
A single SQL or PL/SQL statement may be executed using the
@@ -14024,9 +14097,10 @@ Node-oracledb can be installed on the pre-built [*Database App Development
1402414097
VM*][152] for [VirtualBox][153], which has Oracle Database pre-installed on
1402514098
Oracle Linux.
1402614099

14027-
If you want to use your own database, installing the free [Oracle Database 'XE'
14028-
Express Edition][130] is quick and easy. Other database editions may be
14029-
downloaded [here][154] or [used with Docker][155].
14100+
To get a free database hosted in Oracle Cloud, see [Oracle Cloud Free
14101+
Tier][162]. If you want to use your own database, installing the free [Oracle
14102+
Database 'XE' Express Edition][130] is quick and easy. Other database editions
14103+
may be downloaded [here][154] or [used with Docker][155].
1403014104

1403114105
If you want to install Oracle Linux yourself, it is free from [here][156].
1403214106

@@ -14193,3 +14267,6 @@ can be asked at [AskTom][158].
1419314267
[158]: https://asktom.oracle.com/
1419414268
[159]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-1070805B-0703-457C-8D2E-4EEC26193E5F
1419514269
[160]: https://github.com/oracle/node-oracledb/issues/699#issuecomment-524009129
14270+
[161]: https://docs.oracle.com/en/cloud/paas/atp-cloud/atpud/manage.html
14271+
[162]: https://www.oracle.com//cloud/free/
14272+
[163]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-C672E92D-CE32-4759-9931-92D7960850F7

0 commit comments

Comments
 (0)