Skip to content

Commit ce6373b

Browse files
Show how to use multiple wallets in one process.
1 parent 26cb7f4 commit ce6373b

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

doc/src/user_guide/connection_handling.rst

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2624,7 +2624,7 @@ to two or more Oracle Autonomous Databases, move each ``cwallet.sso`` file to
26242624
its own directory. For each connection use different connection string
26252625
``WALLET_LOCATION`` parameters to specify the directory of each ``cwallet.sso``
26262626
file. It is recommended to use Oracle Client libraries 19.17 (or later) when
2627-
using multiple wallets.
2627+
using :ref:`multiple wallets <connmultiwallets>`.
26282628

26292629
Access Through a Proxy
26302630
+++++++++++++++++++++++
@@ -2792,6 +2792,60 @@ location as the ``wallet_location`` parameter to :func:`oracledb.connect()` or
27922792
f.write(cert.public_bytes(Encoding.PEM))
27932793
print("PEM file", pem_file_name, "written.")
27942794
2795+
.. _connmultiwallets:
2796+
2797+
Connecting using Multiple Wallets
2798+
=================================
2799+
2800+
You can make multiple connections with different wallets in one Python
2801+
process.
2802+
2803+
**In python-oracledb Thin mode**
2804+
2805+
To use multiple wallets in python-oracledb Thin mode, pass the different
2806+
connection strings, wallet locations, and wallet password (if required) in each
2807+
:meth:`oracledb.connect()` call or when creating a :ref:`connection pool
2808+
<connpooling>`:
2809+
2810+
.. code-block:: python
2811+
2812+
connection = oracledb.connect(user=user_name, password=userpw, dsn=dsn,
2813+
config_dir="path_to_extracted_wallet_zip",
2814+
wallet_location="location_of_pem_file",
2815+
wallet_password=walletpw)
2816+
2817+
The ``config_dir`` parameter is the directory containing the :ref:`tnsnames.ora
2818+
<optnetfiles>` file. The ``wallet_location`` parameter is the directory
2819+
containing the ``ewallet.pem`` file. If you are using Oracle Autonomous
2820+
Database, both of these paths are typically the same directory where the
2821+
``wallet.zip`` file was extracted. The ``dsn`` should specify a TCPS
2822+
connection.
2823+
2824+
**In python-oracledb Thick mode**
2825+
2826+
To use multiple wallets in python-oracledb Thick mode, a TCPS connection string
2827+
containing the ``MY_WALLET_DIRECTORY`` option needs to be created:
2828+
2829+
.. code-block:: python
2830+
2831+
dsn = "mydb_high" # one of the network aliases from tnsnames.ora
2832+
params = oracledb.ConnectParams(config_dir="path_to_extracted_wallet_zip",
2833+
wallet_location="path_location_of_sso_file")
2834+
params.parse_connect_string(dsn)
2835+
dsn = params.get_connect_string()
2836+
connection = oracledb.connect(user=user_name, password=password, dsn=dsn)
2837+
2838+
The ``config_dir`` parameter should be the directory containing the
2839+
:ref:`tnsnames.ora <optnetfiles>` and ``sqlnet.ora`` files. The
2840+
``wallet_location`` parameter is the directory containing the ``cwallet.sso``
2841+
file. If you are using Oracle Autonomous Database, both of these paths are
2842+
typically the same directory where the ``wallet.zip`` file was extracted.
2843+
2844+
.. note::
2845+
2846+
Use Oracle Client libraries 19.17, or later, or use Oracle Client 21c.
2847+
They contain important bug fixes for using multiple wallets in the one
2848+
process.
27952849

27962850
.. _connsharding:
27972851

0 commit comments

Comments
 (0)