Skip to content

Commit dfb4142

Browse files
committed
Add DRCP documentation
1 parent 94add8b commit dfb4142

File tree

2 files changed

+79
-16
lines changed

2 files changed

+79
-16
lines changed

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Node-oracledb 0.2 supports basic and advanced Oracle features, including:
1313
- Conversion between JavaScript and Oracle types
1414
- Transaction Management
1515
- Connection Pooling
16+
- [Database Resident Connection Pooling](#http://docs.oracle.com/database/121/ADFNS/adfns_perf_scale.htm#ADFNS228) (DRCP)
1617
- [Statement Caching](http://docs.oracle.com/database/121/LNOCI/oci09adv.htm#i471377)
1718
- [Client Result Caching](http://docs.oracle.com/database/121/ADFNS/adfns_perf_scale.htm#ADFNS464)
1819
- [End-to-end tracing](http://docs.oracle.com/database/121/TGSQL/tgsql_trace.htm#CHDBDGIJ)
@@ -22,10 +23,8 @@ Node-oracledb 0.2 supports basic and advanced Oracle features, including:
2223
- [Transparent Application Failover](http://docs.oracle.com/database/121/ADFNS/adfns_avail.htm#ADFNS534) (TAF)
2324

2425
Node-oracledb 0.2 is a preview release. We are actively working on
25-
adding features including Windows platform support, LOB support, batch
26-
fetching / streaming of large query result sets, and
27-
[DRCP](#http://docs.oracle.com/database/121/ADFNS/adfns_perf_scale.htm#ADFNS228)
28-
support.
26+
adding features including Windows platform support, LOB support, and
27+
batch fetching / streaming of large query result sets.
2928

3029
Share your feedback at the Oracle Technology Network
3130
[Node.js discussion forum](https://community.oracle.com/community/database/developer-tools/node_js/content)

doc/api.md

Lines changed: 76 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- BIND_INOUT
1818
- BIND_OUT
1919
- 3.2 [Oracledb Properties](#oracledbproperties)
20+
- [connectionClass](#propdbconclass)
2021
- [isAutoCommit](#propdbisautocommit)
2122
- [maxRows](#propdbmaxrows)
2223
- [outFormat](#propdboutformat)
@@ -59,8 +60,9 @@
5960
- 5.3.3 [SELECT Statements](#select)
6061
- [Result Type Mapping](#typemap)
6162
- [Statement Caching](#stmtcache)
62-
- 5.4 [Miscellaneous Operations](#miscellaneousops)
63-
6. [External Configuration](#oraaccess)
63+
6. [Transaction Management](#transactionmgt)
64+
7. [Database Resident Connection Pooling](#drcp)
65+
8. [External Configuration](#oraaccess)
6466

6567
## <a name="intro"></a> 1. Introduction
6668

@@ -228,6 +230,26 @@ sessions specified*.
228230

229231
Each of the configuration properties is described below.
230232

233+
<a name="propdbconclass"></a>
234+
```
235+
String connectionClass
236+
```
237+
238+
The Connection class value defines a logical name for connections.
239+
When a pooled session has a connection class, Oracle ensures that the
240+
session is not shared outside of that connection class.
241+
242+
The connection class value is similarly used by
243+
[Database Resident Connection Pooling](#drcp) (DRCP) to allow or
244+
disallow sharing of sessions.
245+
246+
For example, where two different kinds of users share one pool, you
247+
might set ```connectionClass``` to 'HR' for connections that access a
248+
Human Resources system, and it might be set to 'OE' for users of an
249+
Order Entry system. Users will only be given sessions of the
250+
appropriate class, allowing maximal reuse of resources in each case,
251+
and preventing any session information leaking between the two systems.
252+
231253
<a name="propdbisautocommit"></a>
232254
```
233255
Boolean isAutoCommit
@@ -985,13 +1007,20 @@ returned as an array. If `bindParams` is passed as an object, then
9851007
Releases a connection. If the connection was obtained from the pool,
9861008
the connection is returned to the pool.
9871009

1010+
1011+
9881012
##### Description
9891013

9901014
This is an asynchronous call.
9911015

9921016
When a connection is released, any ongoing transaction on the
9931017
connection is rolled back.
9941018

1019+
Note that after releasing a connection to a pool, there is no
1020+
guarantee a subsequent `getConnection()` call gets back the same
1021+
database connection. The application must redo any ALTER SESSION
1022+
statements on the new connection object, as required.
1023+
9951024
##### Prototype
9961025

9971026
```
@@ -1295,11 +1324,10 @@ statements being executed by the application.
12951324
The statement cache can be automatically tuned with the
12961325
[oraaccess.xml file](#oraaccess).
12971326

1298-
### <a name="miscellaneousops"></a> 5.4 Miscellaneous Operations
1327+
## <a name="transactionmgt"></a> 6. Transaction Management
12991328

1300-
Transaction management implements [`commit()`](#commit) and
1301-
[`rollback()`](#rollback) methods. A long-running database operation
1302-
may be interrupted by the [`break()`](#break) call.
1329+
Node-oraclebd implements [`commit()`](#commit) and
1330+
[`rollback()`](#rollback) methods.
13031331

13041332
After all database calls on the connection complete, the application
13051333
should use the [`release()`](#release) call to release the connection.
@@ -1311,15 +1339,51 @@ a subsequent [`pool.getConnection()`](#getconnection2) call, then any
13111339
statements performed on the obtained connection are always in a new
13121340
transaction.
13131341

1314-
Note that after releasing a connection to the pool, there is no
1315-
guarantee a subsequent `getConnection()` call gets back the same
1316-
database connection. The application must redo any ALTER SESSION
1317-
statements on the new connection object, as required.
1318-
13191342
When an application ends, any uncommitted transaction on a connection
13201343
will be rolled back if there is no explicit commit.
13211344

1322-
## <a name="oraaccess"></a> 6. External Configuration
1345+
## <a name="drcp"></a> 7. Database Resident Connection Pooling
1346+
1347+
[Database Resident Connection Pooling](http://docs.oracle.com/database/121/ADFNS/adfns_perf_scale.htm#ADFNS228)
1348+
enables database resource sharing for applications that run in
1349+
multiple client processes or run on multiple middle-tier application
1350+
servers. DRCP reduces the overall number of connections that a
1351+
database must handle.
1352+
1353+
DRCP is distinct from node-oracledb's local
1354+
[connection pool](#poolclass). The two pools can be used separately,
1355+
or together.
1356+
1357+
DRCP is useful for applications which share the same credentials, have
1358+
similar session settings (for example date format settings and PL/SQL
1359+
package state), and where the application gets a database connection,
1360+
works on it for a relatively short duration, and then releases it.
1361+
1362+
To use DRCP in node-oracledb:
1363+
1364+
1. The DRCP pool must be started in the database: `execute dbms_connection_pool.start_pool();`
1365+
2. The `getConnection()` property `connectString` must specify to use a pooled server, either by the Easy Connect syntax like `myhost/sales:POOLED`, or by using a `tnsnames.ora` alias for a connection that contains `(SERVER=POOLED)`.
1366+
3. The [`connectionClass`](#propdbconclass) should be set by the node-oracledb application. If it is not set, the pooled server session memory will not be reused optimally.
1367+
1368+
The DRCP 'Purity' value is NEW for
1369+
[`oracledb.getConnection()`](#getconnection1) connections that do not
1370+
use a local connection pool. These connections reuse a DRCP pooled
1371+
server process (thus avoiding the costs of process creation and
1372+
destruction) but do not reuse its session memory. The 'Purity' is
1373+
SELF for [`pool.getConnection()`](#getconnection2) connections,
1374+
allowing reuse of the pooled server process and session memory, giving
1375+
maximum benefit from DRCP. See the Oracle documentation on
1376+
[benefiting from scalability](http://docs.oracle.com/database/121/ADFNS/adfns_perf_scale.htm#ADFNS506).
1377+
1378+
Refer to the
1379+
[Oracle DRCP documentation](http://docs.oracle.com/database/121/ADFNS/adfns_perf_scale.htm#ADFNS228)
1380+
for more details, including on when to use, and when not to use DRCP.
1381+
The Oracle white paper
1382+
[PHP Scalability and High Availability](http://www.oracle.com/technetwork/topics/php/php-scalability-ha-twp-128842.pdf)
1383+
has more information on DRCP including how to configure and monitor
1384+
it.
1385+
1386+
## <a name="oraaccess"></a> 8. External Configuration
13231387

13241388
When node-oracledb is linked with Oracle 12c client libraries, the Oracle
13251389
client-side configuration file

0 commit comments

Comments
 (0)