@@ -1350,40 +1350,59 @@ of the function :meth:`cx_Oracle.connect()` constructor:
1350
1350
1351
1351
.. _autononmousdb :
1352
1352
1353
- Connecting to Autononmous Databases
1354
- ===================================
1353
+ Connecting to Oracle Cloud Autononmous Databases
1354
+ ================================================
1355
1355
1356
1356
To enable connection to Oracle Autonomous Database in Oracle Cloud, a wallet
1357
- needs be downloaded from the cloud GUI, and cx_Oracle needs to be configured to
1358
- use it. A database username and password is still required. The wallet only
1359
- enables SSL/TLS.
1357
+ needs be downloaded from the cloud, and cx_Oracle needs to be configured to use
1358
+ it. The wallet gives mutual TLS which provides enhanced security for
1359
+ authentication and encryption. A database username and password is still
1360
+ required for your application connections.
1360
1361
1361
1362
Install the Wallet and Network Configuration Files
1362
1363
--------------------------------------------------
1363
1364
1364
- From the Oracle Cloud console for the database, download the wallet zip file. It
1365
- contains the wallet and network configuration files. Note: keep wallet files in
1366
- a secure location and share them only with authorized users.
1365
+ From the Oracle Cloud console for the database, download the wallet zip file.
1366
+ It contains the wallet and network configuration files. Note: keep wallet
1367
+ files in a secure location and share them only with authorized users.
1367
1368
1368
- Unzip the wallet zip file.
1369
-
1370
- For cx_Oracle, only these files from the zip are needed:
1369
+ Unzip the wallet zip file. For cx_Oracle, only these files from the zip are needed:
1371
1370
1372
1371
- ``tnsnames.ora `` - Maps net service names used for application connection strings to your database services
1373
1372
- ``sqlnet.ora `` - Configures Oracle Network settings
1374
1373
- ``cwallet.sso `` - Enables SSL/TLS connections
1375
1374
1376
- The other files and the wallet password are not needed.
1375
+ There are now two options:
1376
+
1377
+ - Move the three files to the ``network/admin `` directory of the client
1378
+ libraries used by your application. For example if you are using Instant
1379
+ Client 19c and it is in ``$HOME/instantclient_19_11 ``, then you would put the
1380
+ wallet files in ``$HOME/instantclient_19_11/network/admin/ ``.
1381
+
1382
+ - Alternatively, move them to any accessible directory, for example
1383
+ ``/opt/OracleCloud/MYDB ``.
1384
+
1385
+ Then edit ``sqlnet.ora `` and change the wallet location directory to the
1386
+ directory containing the ``cwallet.sso `` file. For example::
1387
+
1388
+ WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="/opt/OracleCloud/MYDB")))
1389
+ SSL_SERVER_DN_MATCH=yes
1377
1390
1378
- Place these files as shown in :ref: `Optional Oracle Net Configuration Files <optnetfiles >`.
1391
+ Since the ``tnsnames.ora `` and ``sqlnet.ora `` files are not in the default
1392
+ location, your application needs to indicate where they are, either with
1393
+ ``config_dir `` parameter to :meth: `cx_Oracle.init_oracle_client() `, or using
1394
+ the ``TNS_ADMIN `` environment variable. See :ref: `Optional Oracle Net
1395
+ Configuration Files <optnetfiles>`. Neither of these settings are needed,
1396
+ and you don't need to edit ``sqlnet.ora ``, if you have put all the files in
1397
+ the ``network/admin `` directory.
1379
1398
1380
1399
Run Your Application
1381
1400
--------------------
1382
1401
1383
1402
The ``tnsnames.ora `` file contains net service names for various levels of
1384
1403
database service. For example, if you create a database called CJDB1 with the
1385
1404
Always Free services from the `Oracle Cloud Free Tier
1386
- <https://www.oracle.com// cloud/free/> `__, then you might decide to use the
1405
+ <https://www.oracle.com/cloud/free/> `__, then you might decide to use the
1387
1406
connection string in ``tnsnames.ora `` called ``cjdb1_high ``.
1388
1407
1389
1408
Update your application to use your schema username, its database password, and
@@ -1394,14 +1413,14 @@ a net service name, for example:
1394
1413
connection = cx_Oracle.connect(user = " scott" , password = userpwd,
1395
1414
dsn = " cjdb1_high" , encoding = " UTF-8" )
1396
1415
1397
- Once you have set Oracle environment variables required by your application,
1398
- such as ``TNS_ADMIN ``, you can start your application.
1416
+ Once you have set optional Oracle environment variables used by your
1417
+ application, such as ``TNS_ADMIN ``, you can start your application.
1399
1418
1400
1419
If you need to create a new database schema so you do not login as the
1401
1420
privileged ADMIN user, refer to the relevant Oracle Cloud documentation, for
1402
1421
example see `Create Database Users
1403
- <https://docs.oracle.com/en/cloud/paas/atp-cloud/atpud/manage .html> `__ in the
1404
- Oracle Autonomous Transaction Processing Dedicated Deployments manual.
1422
+ <https://docs.oracle.com/en/cloud/paas/autonomous-database/adbdu/managing-database-users .html#GUID-5B94EA60-554A-4BA4-96A3-1D5A3ED5878D > `__
1423
+ in the Oracle Autonomous Database manual.
1405
1424
1406
1425
Access Through a Proxy
1407
1426
----------------------
0 commit comments