@@ -49,8 +49,10 @@ limitations under the License.
49
49
- 3.2.11 [ poolMin] ( #propdbpoolmin )
50
50
- 3.2.12 [ poolTimeout] ( #propdbpooltimeout )
51
51
- 3.2.13 [ prefetchRows] ( #propdbprefetchrows )
52
- - 3.2.14 [ stmtCacheSize] ( #propdbstmtcachesize )
53
- - 3.2.15 [ version] ( #propdbversion )
52
+ - 3.2.14 [ queueRequests] ( #propdbqueuerequests )
53
+ - 3.2.15 [ queueTimeout] ( #propdbqueuetimeout )
54
+ - 3.2.16 [ stmtCacheSize] ( #propdbstmtcachesize )
55
+ - 3.2.17 [ version] ( #propdbversion )
54
56
- 3.3 [ Oracledb Methods] ( #oracledbmethods )
55
57
- 3.3.1 [ createPool()] ( #createpool )
56
58
- 3.3.2 [ getConnection()] ( #getconnectiondb )
@@ -85,7 +87,9 @@ limitations under the License.
85
87
- 6.1.4 [ poolMax] ( #proppoolpoolmax )
86
88
- 6.1.5 [ poolMin] ( #proppoolpoolmin )
87
89
- 6.1.6 [ poolTimeout] ( #proppoolpooltimeout )
88
- - 6.1.7 [ stmtCacheSize] ( #proppoolstmtcachesize )
90
+ - 6.1.7 [ queueRequests] ( #proppoolqueuerequests )
91
+ - 6.1.8 [ queueTimeout] ( #proppoolqueueTimeout )
92
+ - 6.1.9 [ stmtCacheSize] ( #proppoolstmtcachesize )
89
93
- 6.2 [ Pool Methods] ( #poolmethods )
90
94
- 6.2.1 [ getConnection()] ( #getconnectionpool )
91
95
- 6.2.2 [ terminate()] ( #terminate )
@@ -102,6 +106,7 @@ limitations under the License.
102
106
- 8.1.2 [ Net Service Names for Connection Strings] ( #tnsnames )
103
107
- 8.1.3 [ JDBC and Node-oracledb Connection Strings Compared] ( #notjdbc )
104
108
- 8.2 [ Connection Pooling] ( #connpooling )
109
+ - 8.2.1 [ Connection Pool Monitoring] ( #connpoolmonitor )
105
110
- 8.3 [ Database Resident Connection Pooling (DRCP)] ( #drcp )
106
111
- 8.4 [ External Authentication] ( #extauth )
107
112
9 . [ SQL Execution] ( #sqlexecution )
@@ -564,7 +569,7 @@ request exceeds the number of currently open connections.
564
569
565
570
The default value is 1.
566
571
567
- This property may be overridden when creating a connection pool.
572
+ This property may be overridden when [ creating a connection pool] ( #createpool ) .
568
573
569
574
##### Example
570
575
@@ -583,7 +588,7 @@ The maximum number of connections to which a connection pool can grow.
583
588
584
589
The default value is 4.
585
590
586
- This property may be overridden when creating the connection pool.
591
+ This property may be overridden when [ creating a connection pool] ( #createpool ) .
587
592
588
593
##### Example
589
594
@@ -603,7 +608,7 @@ when there is no activity to the target database.
603
608
604
609
The default value is 0.
605
610
606
- This property may be overridden when creating a connection pool.
611
+ This property may be overridden when [ creating a connection pool] ( #createpool ) .
607
612
608
613
##### Example
609
614
@@ -625,7 +630,7 @@ connections are never terminated.
625
630
626
631
The default value is 60.
627
632
628
- This property may be overridden when creating a connection pool.
633
+ This property may be overridden when [ creating a connection pool] ( #createpool ) .
629
634
630
635
##### Example
631
636
@@ -664,7 +669,55 @@ var oracledb = require('oracledb');
664
669
oracledb .prefetchRows = 100 ;
665
670
```
666
671
667
- #### <a name =" propdbstmtcachesize " ></a > 3.2.14 stmtCacheSize
672
+ #### <a name =" propdbqueuerequests " ></a > 3.2.14 queueRequests
673
+
674
+ ```
675
+ Boolean queueRequests
676
+ ```
677
+
678
+ If this property is * true* and the number of connections "checked out"
679
+ from the pool has reached the number specified by
680
+ [ ` poolMax ` ] ( #propdbpoolmax ) , then new requests for connections are
681
+ queued until in-use connections are released.
682
+
683
+ If this property is * false* and a request for a connection is made
684
+ from a pool where the number of "checked out" connections has reached
685
+ ` poolMax ` , then an * ORA-24418* error indicating that further sessions
686
+ cannot be opened will be returned.
687
+
688
+ The default value is * true* .
689
+
690
+ This property may be overridden when [ creating a connection pool] ( #createpool ) .
691
+
692
+ ##### Example
693
+
694
+ ``` javascript
695
+ var oracledb = require (' oracledb' );
696
+ oracledb .queueRequests = false ;
697
+ ```
698
+
699
+ #### <a name =" propdbqueuetimeout " ></a > 3.2.15 queueTimeout
700
+
701
+ ```
702
+ Number queueTimeout
703
+ ```
704
+
705
+ The number of milliseconds after which connection requests waiting in
706
+ the connection request queue are terminated. If ` queueTimeout ` is
707
+ 0, then queued connection requests are never terminated.
708
+
709
+ The default value is 60000.
710
+
711
+ This property may be overridden when [ creating a connection pool] ( #createpool ) .
712
+
713
+ ##### Example
714
+
715
+ ``` javascript
716
+ var oracledb = require (' oracledb' );
717
+ oracledb .queueTimeout = 3000 ; // 3 seconds
718
+ ```
719
+
720
+ #### <a name =" propdbstmtcachesize " ></a > 3.2.16 stmtCacheSize
668
721
669
722
```
670
723
Number stmtCacheSize
@@ -691,7 +744,7 @@ var oracledb = require('oracledb');
691
744
oracledb .stmtCacheSize = 30 ;
692
745
```
693
746
694
- #### <a name =" propdbversion " ></a > 3.2.15 version
747
+ #### <a name =" propdbversion " ></a > 3.2.17 version
695
748
```
696
749
readonly Number version
697
750
```
@@ -783,10 +836,10 @@ name of a local Oracle database instance. See
783
836
Boolean externalAuth
784
837
```
785
838
786
- If this optional property is * true * then the pool's connections will
787
- be established using [ External Authentication] ( #extauth ) .
839
+ Indicate whether to connections should be established using
840
+ [ External Authentication] ( #extauth ) .
788
841
789
- This property overrides the * Oracledb*
842
+ This optional property overrides the * Oracledb*
790
843
[ ` externalAuth ` ] ( #propdbisexternalauth ) property.
791
844
792
845
The ` user ` and ` password ` properties should not be set when
@@ -800,49 +853,72 @@ Number stmtCacheSize
800
853
```
801
854
802
855
The number of statements to be cached in the
803
- [ statement cache] ( #stmtcache ) of each connection. This optional
804
- property may be used to override the
805
- [ stmtCacheSize ] ( #propdbstmtcachesize ) property of the * Oracledb*
806
- object .
856
+ [ statement cache] ( #stmtcache ) of each connection.
857
+
858
+ This optional property overrides the * Oracledb*
859
+ [ ` stmtCacheSize ` ] ( #propdbstmtcachesize ) property .
807
860
808
861
```
809
862
Number poolMax
810
863
```
811
864
812
865
The maximum number of connections to which a connection pool can grow.
813
866
814
- This optional property may be used to override the corresponding
815
- property in the * Oracledb * object .
867
+ This optional property overrides the * Oracledb *
868
+ [ ` poolMax ` ] ( #propdbpoolmax ) property .
816
869
817
870
```
818
871
Number poolMin
819
872
```
820
873
821
874
The minimum number of connections a connection pool maintains, even
822
- when there is no activity to the target database. This optional
823
- property may be used to override the corresponding property in the
824
- * Oracledb* object.
875
+ when there is no activity to the target database.
876
+
877
+ This optional property overrides the * Oracledb*
878
+ [ ` poolMin ` ] ( #propdbpoolmin ) property.
825
879
826
880
```
827
881
Number poolIncrement
828
882
```
829
883
830
884
The number of connections that are opened whenever a connection
831
- request exceeds the number of currently open connections. This
832
- optional property may be used to override the corresponding property
833
- in the * Oracledb* object.
885
+ request exceeds the number of currently open connections.
886
+
887
+ This optional property overrides the * Oracledb*
888
+ [ ` poolIncrement ` ] ( #propdbpoolincrement ) property.
834
889
835
890
```
836
891
Number poolTimeout
837
892
```
838
893
839
894
The number of seconds after which idle connections (unused in the
840
895
pool) may be terminated. Idle connections are terminated only when
841
- the pool is accessed. If the ` poolTimeout ` is set to 0, then idle
896
+ the pool is accessed. If ` poolTimeout ` is set to 0, then idle
842
897
connections are never terminated.
843
898
844
- This optional property may be used to override the corresponding
845
- property in the * Oracledb* object.
899
+ This optional property overrides the * Oracledb*
900
+ [ ` poolTimeout ` ] ( #propdbpooltimeout ) property.
901
+
902
+ ```
903
+ Boolean queueRequests
904
+ ```
905
+
906
+ Indicate whether [ ` pool.getConnection() ` ] ( #getconnectionpool ) calls
907
+ should be queued when all available connections are in currently use.
908
+
909
+ This optional property overrides the * Oracledb*
910
+ [ ` queueRequests ` ] ( #propdbqueuerequests ) property.
911
+
912
+ ```
913
+ Number queueTimeout
914
+ ```
915
+
916
+ The number of milliseconds after which connection requests waiting in the
917
+ connection request queue are terminated. If ` queueTimeout ` is
918
+ set to 0, then queued connection requests are never terminated.
919
+
920
+ This optional property overrides the * Oracledb*
921
+ [ ` queueTimeout ` ] ( #propdbqueuetimeout ) property.
846
922
847
923
```
848
924
function(Error error, Pool pool)
@@ -1533,10 +1609,29 @@ readonly Number poolTimeout
1533
1609
```
1534
1610
1535
1611
The time (in seconds) after which the pool terminates idle connections
1536
- (unused in the pool). The number of connection does not drop below
1612
+ (unused in the pool). The number of connections does not drop below
1537
1613
poolMin.
1538
1614
1539
- #### <a name =" proppoolstmtcachesize " ></a > 6.1.7 stmtCacheSize
1615
+ #### <a name =" proppoolqueuerequests " ></a > 6.1.7 queueRequests
1616
+
1617
+ ```
1618
+ readonly Boolean queueRequests
1619
+ ```
1620
+
1621
+ Determines whether requests for connections from the pool are queued
1622
+ when the number of connections "checked out" from the pool has reached
1623
+ the maximum number specified by [ ` poolMax ` ] ( #propdbpoolmax ) .
1624
+
1625
+ #### <a name =" proppoolqueueTimeout " ></a > 6.1.8 queueTimeout
1626
+
1627
+ ```
1628
+ readonly Number queueTimeout
1629
+ ```
1630
+
1631
+ The time (in milliseconds) that a connection request should wait in
1632
+ the queue before the request is terminated.
1633
+
1634
+ #### <a name =" proppoolstmtcachesize " ></a > 6.1.9 stmtCacheSize
1540
1635
1541
1636
```
1542
1637
readonly Number stmtCacheSize
@@ -1545,9 +1640,6 @@ readonly Number stmtCacheSize
1545
1640
The number of statements to be cached in the
1546
1641
[ statement cache] ( #stmtcache ) of each connection.
1547
1642
1548
- The default is the [ ` stmtCacheSize ` ] ( #propdbstmtcachesize ) property of
1549
- the * Oracledb* object when the pool is created.
1550
-
1551
1643
### <a name =" poolmethods " ></a > 6.2 Pool Methods
1552
1644
1553
1645
#### <a name =" getconnectionpool " ></a > 6.2.1 getConnection()
@@ -1911,7 +2003,7 @@ object. Internally
1911
2003
[OCI Session Pooling](https://docs.oracle.com/database/121/LNOCI/oci09adv.htm#LNOCI16617)
1912
2004
is used.
1913
2005
1914
- Connection are returned with the *Pool*
2006
+ A connection is returned with the *Pool*
1915
2007
[` getConnection ()` ](#getconnectionpool) function:
1916
2008
1917
2009
` ` ` javascript
@@ -1959,9 +2051,51 @@ The Pool attribute [`stmtCacheSize`](#propconnstmtcachesize) can be
1959
2051
used to set the statement cache size used by connections in the pool,
1960
2052
see [Statement Caching](#stmtcache).
1961
2053
1962
- A pool can be monitored by looking at the Pool attributes
1963
- [` connectionsInUse` ](#proppoolconnectionsinuse) and
1964
- [` connectionsOpen` ](#proppoolconnectionsopen).
2054
+ #### <a name="connpoolmonitor"></a> 8.2.1 Connection Pool Monitoring
2055
+
2056
+ Connection pool usage can be monitored to choose the appropriate
2057
+ connection pool settings for your workload.
2058
+
2059
+ The Pool attributes [` connectionsInUse` ](#proppoolconnectionsinuse)
2060
+ and [` connectionsOpen` ](#proppoolconnectionsopen) provide basic
2061
+ information about an active pool.
2062
+
2063
+ When using a [pool queue](#propdbqueuerequests), further statistics
2064
+ can be enabled by setting the [` createPool ()` ](#createpool)
2065
+ ` poolAttrs` parameter ` _enableStats` to *true*. Statistics
2066
+ can be output to the console by calling the *Pool* ` _logStats ()`
2067
+ method. The underscore prefixes indicate that these are private
2068
+ attributes and methods. As such, this functionality may be altered or
2069
+ enhanced in the future.
2070
+
2071
+ Queue statistics include the number of ` getConnection ()` requests that
2072
+ were queued waiting for an available connection. The sum and average
2073
+ time spent in the queue are also recorded. If the pool queue is
2074
+ heavily used, consider increasing the connection pool
2075
+ [` poolMax` ](#proppoolpoolmax) value.
2076
+
2077
+ To enable recording of queue statistics:
2078
+
2079
+ ` ` ` javascript
2080
+ oracledb .createPool (
2081
+ {
2082
+ queueRequests : true , // default is true
2083
+ _enableStats : true , // default is false
2084
+ user : " hr" ,
2085
+ password : " welcome" ,
2086
+ connectString : " localhost/XE"
2087
+ },
2088
+ function (err , pool )
2089
+ {
2090
+ . . .
2091
+ ` ` `
2092
+
2093
+ The application can later, on some developer-chosen event, display the
2094
+ current statistics to the console by calling:
2095
+
2096
+ ` ` ` javascript
2097
+ pool ._logStats ();
2098
+ ` ` `
1965
2099
1966
2100
Node worker threads executing database statements on a connection will
1967
2101
commonly wait for round-trips between node-oracledb and the database
@@ -2038,7 +2172,7 @@ to validate user access. One of the benefits is that database
2038
2172
credentials do not need to be hard coded in the application.
2039
2173
2040
2174
To use external authentication, set the *Oracledb*
2041
- [` externalAuth` ](propdbextauth ) property to *true*. This property can
2175
+ [` externalAuth` ](#propdbisexternalauth ) property to *true*. This property can
2042
2176
also be set in the ` connAttrs` or ` poolAttrs` parameters of the
2043
2177
*Oracledb* [` getConnection ()` ](#getconnectiondb) or
2044
2178
[` createPool ()` ](#createpool) calls, respectively. The ` user` and
@@ -2118,7 +2252,7 @@ less overhead.
2118
2252
2119
2253
A result set is created when the ` execute ()` option property
2120
2254
[` resultSet` ](#executeoptions) is ` true ` . Result set rows can be
2121
- fetched using [` getRow ()` ](#getrow) or [` getRows ()` ](getrows) on the
2255
+ fetched using [` getRow ()` ](#getrow) or [` getRows ()` ](# getrows) on the
2122
2256
` execute ()` callback function's ` result .resultSet ` parameter property.
2123
2257
2124
2258
For result sets the [` maxRows` ](#propdbmaxrows) limit is ignored. All
@@ -3154,7 +3288,7 @@ If the `WHERE` clause matches no rows, the output would be:
3154
3288
Oracle REF CURSORS can be fetched in node-oracledb by binding a
3155
3289
` CURSOR ` to a PL/SQL call. The resulting bind variable becomes a
3156
3290
[` ResultSet` ](#resultsetclass), allowing rows to be fetched using
3157
- [` getRow ()` ](#getrow) or [` getRows ()` ](getrows). When all rows have
3291
+ [` getRow ()` ](#getrow) or [` getRows ()` ](# getrows). When all rows have
3158
3292
been fetched, or the application does not want to continue getting
3159
3293
more rows, then the result set must be freed using
3160
3294
[` close ()` ](#close). If the REF cursor is not set to any value, or is
0 commit comments