Skip to content

Commit 41a1e15

Browse files
committed
Documentation update for the new getNetworkServiceNames() metjod and minor update for npmignore
1 parent 701e564 commit 41a1e15

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.gitmodules
55
.eslintrc
66
.readthedocs.yaml
7+
.gitlab-ci.yml
78
INSTALL.md
89
CONTRIBUTING.md
910
Makefile

doc/src/api_manual/oracledb.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3039,6 +3039,44 @@ Oracledb Methods
30393039
* - Connection ``connection``
30403040
- The newly created connection. If ``getConnection()`` fails, connection will be NULL. See :ref:`Connection class <connectionclass>` for more details.
30413041

3042+
.. method:: oracledb.getNetworkServiceNames()
3043+
3044+
.. versionadded:: 6.7
3045+
3046+
.. code-block:: javascript
3047+
3048+
promise = getNetworkServiceNames(String configDir);
3049+
3050+
Returns a list of network service names that is defined in the
3051+
:ref:`tnsnames.ora <tnsadmin>` file which is inside the directory that
3052+
is specified in the ``configDir`` property or the ``TNS_ADMIN``
3053+
environment variable if ``configDir`` is not specified. If a
3054+
``tnsnames.ora`` file does not exist, then an exception is raised.
3055+
3056+
The parameters of the ``oracledb.getNetworkServiceNames()`` method are:
3057+
3058+
.. _getnetworkservicenameattrs:
3059+
3060+
.. list-table-with-summary:: oracledb.getNetworkServiceNames() Parameters
3061+
:header-rows: 1
3062+
:class: wy-table-responsive
3063+
:align: center
3064+
:widths: 10 10 30
3065+
:summary: The first column displays the parameter. The second column
3066+
displays the data type of the parameter. The third column displays
3067+
the description of the parameter.
3068+
3069+
* - Parameter
3070+
- Data Type
3071+
- Description
3072+
* - ``configDir``
3073+
- String
3074+
- The directory in which the :ref:`tnsnames.ora <tnsadmin>` file resides.
3075+
3076+
If ``configDir`` is not specified, then the ``tnsnames.ora`` file is searched for in the directory specified in the ``TNS_ADMIN`` Oracle environment variable.
3077+
3078+
See :ref:`tnsnames`.
3079+
30423080
.. method:: oracledb.getPool()
30433081

30443082
.. code-block:: javascript

doc/src/user_guide/connection_handling.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,42 @@ dblatest&id=GUID-7F967CE5-5498-427C-9390-4A5C6767ADAA>`__.
237237
not be automatically located. The file's directory must be explicitly
238238
specified when connecting.
239239

240+
You can retrieve the network service names that are defined in the
241+
:ref:`tnsnames.ora <tnsadmin>` file using
242+
:meth:`oracledb.getNetworkServiceNames()`. The directory that contains the
243+
``tnsnames.ora`` file can be specified in the ``configDir`` property of
244+
:meth:`~oracledb.getNetworkServiceNames()`. For example, if the
245+
``tnsnames.ora`` file is stored in the ``/opt/oracle/config`` directory and
246+
contains the following network service names::
247+
248+
sales =
249+
(DESCRIPTION =
250+
(ADDRESS = (PROTOCOL = TCP)(HOST = mymachine.example.com)(PORT = 1521))
251+
(CONNECT_DATA =
252+
(SERVER = DEDICATED)
253+
(SERVICE_NAME = ORCL)
254+
)
255+
)
256+
257+
finance =
258+
(DESCRIPTION =
259+
(ADDRESS = (PROTOCOL = TCP)(HOST = mydbmachine.example.com)(PORT = 1521))
260+
(CONNECT_DATA =
261+
(SERVER = DEDICATED)
262+
(SERVICE_NAME = ORCLPDB1)
263+
)
264+
)
265+
266+
To retrieve the network service names from the above ``tnsnames.ora`` file,
267+
you can use:
268+
269+
.. code-block:: javascript
270+
271+
const serviceNames = await oracledb.getNetworkServiceNames("/opt/oracle/config");
272+
console.log(serviceNames);
273+
274+
This prints ``['sales', 'finance']`` as the output.
275+
240276
.. _notjdbc:
241277

242278
JDBC and Oracle SQL Developer Connection Strings

0 commit comments

Comments
 (0)