You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The file configuration provider enables the storage and management of Oracle
539
+
Database connection information as JSON in a file on your local file system.
540
+
541
+
When a connection or pool creation method is called with the prefix
542
+
``config-file://`` for its ``dsn`` parameter, a built-in :ref:`connection hook
543
+
function <connectionhook>` is internally invoked. This function parses the DSN
544
+
and loads the configuration information which is stored in the specified file
545
+
as JSON. The hook function sets the connection information in its
546
+
``connect_params`` parameter. This :ref:`ConnectParams <connparam>` object is
547
+
used by python-oracledb to establish a connection to Oracle Database.
548
+
549
+
The configuration file must contain at least the database connection
550
+
string. Optionally, you can add the database user name, password, and
551
+
python-oracledb specific properties. The JSON properties that can be added to
552
+
the file are listed in the table below.
553
+
554
+
.. list-table-with-summary:: JSON properties for the File Configuration Provider
555
+
:header-rows: 1
556
+
:class: wy-table-responsive
557
+
:widths: 15 25 15
558
+
:name: _file_configuration_provider
559
+
:summary: The first column displays the name of the property. The second column displays its description. The third column displays whether the sub-object is required or optional.
560
+
561
+
* - Sub-object
562
+
- Description
563
+
- Required or Optional
564
+
* - ``user``
565
+
- The database user name.
566
+
- Optional
567
+
* - ``password``
568
+
- The password of the database user, or a dictionary containing the key "type" and password type-specific properties.
569
+
- Optional
570
+
* - ``connect_descriptor``
571
+
- The database :ref:`connection string <connstr>`. The file must contain this property.
572
+
- Required
573
+
* - ``pyo``
574
+
- Python-oracledb specific settings.
575
+
- Optional
576
+
577
+
See the `Oracle Net Service Administrator’s Guide <https://www.oracle.com/pls/
578
+
topic/lookup?ctx=dblatest&id=GUID-B43EA22D-5593-40B3-87FC-C70D6DAF780E>`__ for
579
+
more information on these sub-objects.
580
+
581
+
.. warning::
582
+
583
+
Storing passwords in the configuration file should only ever be used in
584
+
development or test environments.
585
+
586
+
When using the password type handler for "base64", a warning message will
587
+
be generated: "base64 encoded passwords are insecure".
588
+
589
+
590
+
**Sample File Configuration Provider syntax**
591
+
592
+
.. _singlefileconfiguration:
593
+
594
+
The following sample is an example of the File Configuration Provider syntax::
:summary: The first column displays the name of the connection string parameter. The second column displays the description of the connection string parameter.
646
+
647
+
* - Parameter
648
+
- Description
649
+
* - ``config-file``
650
+
- Indicates that the centralized configuration provider is a file in your local system.
651
+
* - <file-name>
652
+
- The file path (absolute or relative path) and name of the JSON file that contains the configuration information. For relative paths, python-oracledb will use the ``config_dir`` value to create an absolute path.
653
+
* - ``key``
654
+
- The connection key name used to identify a specific configuration. If this parameter is specified, the file is assumed to contain multiple configurations that are indexed by the key. If not specified, the file is assumed to contain a single configuration.
655
+
656
+
For example, if you have a configuration file in
657
+
``/opt/oracle/my-config1.json`` with a :ref:`single configuration
:summary: The first column displays the name of the connection string parameter. The second column displays the description of the connection string parameter.
4120
-
4121
-
* - Parameter
4122
-
- Description
4123
-
* - ``config-file``
4124
-
- Indicates that the centralized configuration provider is a file in your local system.
4125
-
* - <file-name>
4126
-
- The file path (absolute or relative path) and name of the JSON file that contains the configuration information. For relative paths, python-oracledb will use the ``config_dir`` value to create an absolute path.
4127
-
* - ``key``
4128
-
- The connection key name used to identify a specific configuration. If this parameter is specified, the file is assumed to contain multiple configurations that are indexed by the key. If not specified, the file is assumed to contain a single configuration.
4129
-
4130
-
For example, to access the "myfile.json" JSON file and the "key2" configuration
4131
-
from the :ref:`multiple configurations sample <multipleconfigurations>` shown
0 commit comments