@@ -129,19 +129,16 @@ If you like to encapsulate values, parameters can be passed using a
129
129
conn = oracledb.connect(user = " my_user" , password = " my_password" , params = params)
130
130
131
131
Some values such as the database host name can be specified as ``connect() ``
132
- parameters, as part of the connect string, and in the ``params `` object. If a
133
- ``dsn `` is passed, the python-oracledb :ref: `Thick <enablingthick >` mode will
134
- use the ``dsn `` string to connect. Otherwise, a connection string is internally
135
- constructed from the individual parameters and ``params `` object values, with
136
- the individual parameters having precedence. In python-oracledb's default Thin
137
- mode, a connection string is internally used that contains all relevant values
138
- specified. The precedence in Thin mode is that values in any ``dsn `` parameter
139
- override values passed as individual parameters, which themselves override
140
- values set in the ``params `` object. Similar precedence rules also apply to
141
- other values.
132
+ parameters, as part of the connect string, and in the ``params `` object. If a
133
+ ``dsn `` is passed, a connection string is internally constructed from the
134
+ individual parameters and ``params `` object values, with the individual
135
+ parameters having precedence. The precedence is that values in any ``dsn ``
136
+ parameter override values passed as individual parameters, which themselves
137
+ override values set in the ``params `` object. Similar precedence rules also
138
+ apply to other values.
142
139
143
140
A single, combined connection string can be passed to ``connect() `` but this
144
- may cause complications if the password contains '@' or '/' characters:
141
+ may cause complications if the password contains "@" or "/" characters:
145
142
146
143
.. code-block :: python
147
144
@@ -329,26 +326,37 @@ If the database is using a non-default port, it must be specified:
329
326
The Easy Connect syntax supports Oracle Database service names. It cannot be
330
327
used with the older System Identifiers (SID).
331
328
332
- The latest `Easy Connect <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&
329
+ The `Easy Connect <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&
333
330
id=GUID-8C85D289-6AF3-41BC-848B-BF39D32648BA> `__ syntax allows the use of
334
331
multiple hosts or ports, along with optional entries for the wallet location,
335
332
the distinguished name of the database server, and allows some network
336
333
configuration options such as the connection timeout and keep-alive values to
337
- be set. This means that a :ref: `sqlnet.ora <optnetfiles >` file is not needed
338
- for some common connection scenarios. See the technical brief `Oracle Database
339
- Easy Connect Plus <https://download.oracle.com/ocomdocs/global/Oracle-Net-Easy
340
- -Connect-Plus.pdf> `__ for more information.
334
+ be set::
341
335
342
- In python-oracledb Thin mode, any unknown Easy Connect options are ignored and
343
- are not passed to the database. See :ref: `Connection String Differences
344
- <diffconnstr>` for more information.
336
+ .. code-block :: python
345
337
346
- In python-oracledb Thick mode, it is the Oracle Client libraries that parse the
347
- Easy Connect string. Check the Easy Connect Naming method in `Oracle Net
348
- Service Administrator's Guide
349
- <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&
350
- id=GUID-B0437826-43C1-49EC-A94D-B650B6A4A6EE> `__ for the syntax to use in your
351
- version of the Oracle Client libraries.
338
+ connection = oracledb.connect(user = " hr" , password = userpwd,
339
+ dsn = " dbhost.example.com/orclpdb?expire_time=2" )
340
+
341
+ This means that a :ref: `sqlnet.ora <optnetfiles >` file is not needed for common
342
+ connection scenarios. See the technical brief `Oracle Database Easy Connect
343
+ Plus <https://download.oracle.com/ocomdocs/global/Oracle-Net-Easy
344
+ -Connect-Plus.pdf> `__ for additional information.
345
+
346
+ Python-oracledb specific settings can also be passed as Easy Connect arguments.
347
+ For example to set the statement cache size used by connections::
348
+
349
+ .. code-block :: python
350
+
351
+ connection = oracledb.connect(user = " hr" , password = userpwd,
352
+ dsn = " dbhost.example.com/orclpdb?pyo.stmtcachesize=50" )
353
+
354
+ See :ref: `defineconnparams ` and :ref: `definepoolparams ` for the settings that
355
+ can be passed as arguments.
356
+
357
+ Any Easy Connect parameters that are unknown to python-oracledb are ignored and
358
+ not passed to the database. See :ref: `Connection String Differences
359
+ <diffconnstr>` for more information.
352
360
353
361
.. _conndescriptor :
354
362
@@ -386,6 +394,9 @@ This prints::
386
394
387
395
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=dbhost.example.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orclpdb))(SECURITY=(SSL_SERVER_DN_MATCH=True)))
388
396
397
+ The ``CONNECT_DATA `` parameters of a full connect descriptor that are
398
+ unrecognized by python-oracledb are passed to the database unchanged.
399
+
389
400
.. _netservice :
390
401
391
402
TNS Aliases for Connection Strings
@@ -1216,12 +1227,9 @@ Note :meth:`ConnectParams.set()` has no effect after
1216
1227
1217
1228
Some values such as the database host name can be specified as
1218
1229
:func: `oracledb.connect() `, parameters, as part of the connect string, and in
1219
- the ``params `` object. If a ``dsn `` is passed, the python-oracledb :ref: `Thick
1220
- <enablingthick>` mode will use the ``dsn `` string to connect. Otherwise, a
1221
- connection string is internally constructed from the individual parameters and
1222
- ``params `` object values, with the individual parameters having precedence. In
1223
- python-oracledb's default Thin mode, a connection string is internally used
1224
- that contains all relevant values specified. The precedence in Thin mode is
1230
+ the ``params `` object. If a ``dsn `` is passed, a connection string is
1231
+ internally constructed from the individual parameters and ``params `` object
1232
+ values, with the individual parameters having precedence. The precedence is
1225
1233
that values in any ``dsn `` parameter override values passed as individual
1226
1234
parameters, which themselves override values set in the ``params `` object.
1227
1235
Similar precedence rules also apply to other values.
@@ -2454,15 +2462,12 @@ individually using the ``set()`` method:
2454
2462
2455
2463
Some values such as the database host name, can be specified as
2456
2464
:func: `oracledb.create_pool() ` parameters, as part of the connect string, and
2457
- in the ``params `` object. If a ``dsn `` is passed, the python-oracledb
2458
- :ref: `Thick <enablingthick >` mode will use the ``dsn `` string to connect.
2459
- Otherwise, a connection string is internally constructed from the individual
2460
- parameters and ``params `` object values, with the individual parameters having
2461
- precedence. In python-oracledb's default Thin mode, a connection string is
2462
- internally used that contains all relevant values specified. The precedence in
2463
- Thin mode is that values in any ``dsn `` parameter override values passed as
2464
- individual parameters, which themselves override values set in the ``params ``
2465
- object. Similar precedence rules also apply to other values.
2465
+ in the ``params `` object. If a ``dsn `` is passed, a connection string is
2466
+ internally constructed from the individual parameters and ``params `` object
2467
+ values, with the individual parameters having precedence. The precedence is
2468
+ that values in any ``dsn `` parameter override values passed as individual
2469
+ parameters, which themselves override values set in the ``params `` object.
2470
+ Similar precedence rules also apply to other values.
2466
2471
2467
2472
.. _definepoolparams :
2468
2473
0 commit comments