@@ -481,12 +481,13 @@ Connection Pooling
481
481
Applications which frequently create and close connections should use a
482
482
connection pool. This is important for performance and scalability when
483
483
applications need to handle a large number of users who do database work for
484
- short periods of time but have relatively long periods when the connections are
485
- not needed. The high availability features of pools also make small pools
484
+ short periods of time but have relatively long periods when the connections
485
+ are not needed. The high availability features of pools also make small pools
486
486
useful for applications that want a few connections available for infrequent
487
- use and requires them to be immediately usable when acquired. Applications that
488
- would benefit from connection pooling but are too difficult to modify from
489
- standalone connections may be able to take advantage of :ref: `implicitpool `.
487
+ use and requires them to be immediately usable when acquired. Applications
488
+ that would benefit from connection pooling but are too difficult to modify
489
+ from the use of standalone connections can take advantage of
490
+ :ref: `implicitpool `.
490
491
491
492
Each node-oracledb process can use one or more connection pools. Each pool can
492
493
contain zero or more connections. In addition to providing an immediately
@@ -2862,59 +2863,81 @@ Implicit Connection Pooling with DRCP and PRCP
2862
2863
----------------------------------------------
2863
2864
2864
2865
Starting from Oracle Database 23c , Node .js applications that use
2865
- : ref: ` DRCP <drcp>` or ` Proxy Resident Connection Pooling (PRCP) <https://
2866
- www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-E5586BC8-6311-434D-B605-
2867
- 204560D3A777>` __ in Oracle Connection Manager in Traffic Director Mode
2868
- (CMAN - TDM ) can enable implicit connection pooling with DRCP and PRCP . With
2869
- this feature, applications do not need to explicitly close or release a
2870
- connection to return the connection back to the DRCP or PRCP pool.
2866
+ : ref: ` DRCP <drcp>` and Oracle Connection Manager in Traffic Director Mode' s
2867
+ (CMAN-TDM) pooling capability `Proxy Resident Connection Pooling (PRCP)
2868
+ <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-E0032017-03B1-
2869
+ 4F14-AF9B-BCC87C982DA8>`__ can enable `implicit connection pooling <https://
2870
+ www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-A9D74994-D81A-47BF-BAF2-
2871
+ E4E1A354CA99>`__ with DRCP and PRCP. For more information on PRCP, see the
2872
+ Oracle technical brief `CMAN-TDM — An Oracle Database connection proxy for
2873
+ scalable and highly available applications <https://download.oracle.com/
2874
+ ocomdocs/global/CMAN_TDM_Oracle_DB_Connection_Proxy_for_scalable_apps.pdf>`__.
2875
+
2871
2876
Applications that do not use client-side connection pooling can take advantage
2872
2877
of the implicit connection pooling feature. Both node-oracledb Thin and Thick
2873
2878
modes support implicit connection pooling. The Thick mode requires Oracle 23c
2874
2879
Client libraries for implicit connection pooling support. The Thin mode works
2875
2880
with implicit connection pooling from node-oracledb 6.4 onwards.
2876
2881
2877
- Implicit connection pooling uses two types of boundary values to determine
2878
- when the connection should be released back to the DRCP or PRCP pool . The
2882
+ With implicit connection pooling, applications do not need to explicitly close
2883
+ or release a connection to return the connection back to the DRCP or PRCP
2884
+ pool. This feature uses two types of boundary values which determine when
2885
+ connections are implicitly released back to the DRCP or PRCP pool. The
2879
2886
boundary value can be specified in the ``POOL_BOUNDARY`` parameter in the
2880
2887
:ref:`Easy Connect string <easyconnect>` or the
2881
2888
:ref:`Connect Descriptor string <embedtns>`. The two boundary values which
2882
2889
can be specified in the ``POOL_BOUNDARY`` parameter are:
2883
2890
2884
2891
- *STATEMENT*: If this boundary value is specified, then the connection is
2885
- released back to the DRCP or PRCP connection pool when the connection is
2886
- implicitly stateless . A connection is implicitly stateless when all open
2887
- cursors in a session have been fetched through to completion, and there
2888
- are no active transactions, temporary tables, or temporary LOBs.
2889
-
2890
- - * TRANSACTION * : If this boundary value is specified, then the connection is
2891
- released back to the DRCP or PRCP connection pool when a
2892
- : meth: ` commit <connection.commit>` or : meth: ` rollback <connection.rollback>`
2893
- is explicitly performed on the transaction in progress on the connection.
2894
- It is recommended to not set the : attr: ` Connection.autocommit` property to
2895
- * true * when using implicit connection pooling.
2896
-
2897
- To use implicit connection pooling with DRCP or PRCP , you must specify the
2898
- server type as * pooled* and set the ` ` POOL_BOUNDARY ` ` attribute to either
2899
- * STATEMENT * or * TRANSACTION * in:
2892
+ released back to the DRCP or PRCP pool when the connection is implicitly
2893
+ stateless. A connection is implicitly stateless when all open cursors in a
2894
+ session have been fetched through to completion, and there are no active
2895
+ transactions, no temporary tables, and no temporary LOBs.
2896
+
2897
+ - *TRANSACTION*: If this boundary value is specified, then a connection is
2898
+ released back to the DRCP or PRCP pool when either one of the methods
2899
+ :meth:`connection.commit()` or :meth:`connection.rollback()` are
2900
+ called. It is recommended to not set the
2901
+ :ref:`autoCommit <propexecautocommit>` property to *true* when using
2902
+ implicit connection pooling. If you do set this attribute to *true*, then
2903
+ you will be unable to:
2904
+
2905
+ - Fetch any data that requires multiple :ref:`round-trips <roundtrips>` to
2906
+ the database
2907
+ - Run queries that fetch :ref:`LOB <lobhandling>` and
2908
+ :ref:`JSON <jsondatatype>` data
2909
+
2910
+ To use implicit connection pooling with DRCP or PRCP in node-oracledb, you
2911
+ must specify the server type as *pooled* and set the ``POOL_BOUNDARY``
2912
+ attribute to either *STATEMENT* or *TRANSACTION* in:
2900
2913
2901
2914
- The :ref:`Easy Connect string <easyconnect>`. For example, to use implicit
2902
- connection pooling with the statement boundary value :
2915
+ connection pooling with the * statement* boundary:
2903
2916
2904
2917
.. code-block:: javascript
2905
2918
2906
- dsn = localhost: 1521 / orclpdb: pooled? pool_boundary= statement
2919
+ const connection = await oracledb.getConnection({
2920
+ user : "hr",
2921
+ password : mypw, // mypw contains the hr schema password
2922
+ connectString : "mydbmachine.example.com:1521/orclpdb1:pooled?pool_boundary=statement"
2923
+ });
2907
2924
2908
2925
- Or the ``CONNECT_DATA`` section of the
2909
2926
:ref:`Connect Descriptor string <embedtns>`. For example, to use implicit
2910
- connection pooling with the transaction boundary value:
2911
-
2912
- .. code - block:: javascript
2927
+ connection pooling with the *transaction* boundary::
2913
2928
2914
2929
tnsalias = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mymachine.example.com)
2915
2930
(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)
2916
2931
(SERVER=POOLED)(POOL_BOUNDARY=TRANSACTION)))
2917
2932
2933
+ If you specify an invalid ``POOL_BOUNDARY`` in the
2934
+ :ref:`Easy Connect string <easyconnect>` or the
2935
+ :ref:`Connect Descriptor string <embedtns>`, then the following error is
2936
+ returned::
2937
+
2938
+ ORA-24545: invalid value of POOL_BOUNDARY specified in connect
2939
+ string
2940
+
2918
2941
.. note::
2919
2942
2920
2943
- Implicit connection pooling is disabled if the application sets the
@@ -2925,8 +2948,8 @@ server type as *pooled* and set the ``POOL_BOUNDARY`` attribute to either
2925
2948
*SELF*. You can specify the purity using the ``POOL_PURITY`` parameter
2926
2949
in the connection string to override the default purity value.
2927
2950
2928
- Note that it is recommended to use : ref: ` connpooling ` over implicit connection
2929
- pooling.
2951
+ Note that it is recommended to use :ref:`connection pooling <connpooling>`
2952
+ over implicit connection pooling.
2930
2953
2931
2954
.. _privconn:
2932
2955
0 commit comments