Skip to content

Commit 45a6a3e

Browse files
committed
Various doc tidy-ups
1 parent 2dd61b5 commit 45a6a3e

File tree

1 file changed

+45
-24
lines changed

1 file changed

+45
-24
lines changed

doc/api.md

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,10 @@ For installation information, see the [Node-oracledb Installation Instructions][
558558

559559
## <a name="intro"></a> 1. Introduction
560560

561-
The [*node-oracledb*][1] add-on for Node.js powers high performance Oracle Database applications.
562-
Applications can be written in TypeScript, or directly in JavaScript.
561+
The [*node-oracledb*][1] add-on for Node.js powers high performance Oracle
562+
Database applications. You can use node-oracledb in your Node.js TypeScript or
563+
JavaScript code. This lets you easily write complex applications, or build
564+
sopisticated web services using [REST][199] or [GraphQL][200].
563565

564566
This document shows how to use node-oracledb. The API reference is in the first
565567
sections of this document and the [user manual](#usermanual) in subsequent
@@ -571,6 +573,7 @@ current Oracle Databases. However the documentation may describe some
571573
database features that are in specific Oracle Database versions,
572574
editions, or require additional database options or packs.
573575

576+
574577
#### Node-oracledb Features
575578

576579
The node-oracledb feature highlights are:
@@ -8778,7 +8781,10 @@ If you set `UV_THREADPOOL_SIZE` too late, the setting will be ignored and the
87788781
default thread pool size of 4 will still be used. Note that
87798782
[`pool.getStatistics()`](#poolgetstatistics) and
87808783
[`pool.logStatistics()`](#poollogstatistics) can only give the value of the
8781-
variable, not the actual size of the thread pool created.
8784+
variable, not the actual size of the thread pool created. On Linux you can use
8785+
`pstack` to see how many threads are actually running. Note Node.js will
8786+
create a small number of threads in addition to the expected number of worker
8787+
threads.
87828788

87838789
The '[libuv][21]' library used by Node.js 12.5 and earlier limits the number of
87848790
threads to 128. In Node.js 12.6 onward the limit is 1024. You should restrict
@@ -8797,15 +8803,14 @@ number of worker threads may improve throughput and prevent [deadlocks][22].
87978803

87988804
#### <a name="parallelism"></a> 15.2.1 Parallelism on a Connection
87998805

8800-
Each connection to Oracle Database can only do one operation at a time.
8806+
Oracle Database can only execute operations one at a time on each connection.
88018807
Examples of operations include `connection.execute()`,
88028808
`connection.executeMany()`, `connection.queryStream()`,
88038809
`connection.getDbObjectClass()`, `connection.commit()`, `connection.close()`,
88048810
[SODA](#sodaoverview) calls, and streaming from [Lobs](#lobclass). Multiple
88058811
connections may be in concurrent use, but each connection can only do one thing
88068812
at a time. Code will not run faster when parallel database operations are
8807-
attempted using a single connection because operations can only be executed
8808-
sequentially by node-oracledb.
8813+
attempted using a single connection.
88098814

88108815
From node-oracledb 5.2, node-oracledb function calls that use a single
88118816
connection for concurrent database access will be queued in the JavaScript layer
@@ -10309,14 +10314,16 @@ appropriate application-specific recovery.
1030910314

1031010315
#### <a name="connectionpremclose"></a> 15.9.1 Preventing Premature Connection Closing
1031110316

10312-
When connections are idle, external timeouts may disconnect them from the
10313-
database. This can impact scalability, cause connection storms, and lead to
10314-
application errors when invalid connections are attempted to be used.
10317+
When connections are idle, external events may disconnect them from the
10318+
database. Unnecessarily having to re-establish connections can impact
10319+
scalability, cause connection storms, or lead to application errors when
10320+
invalid connections are attempted to be used.
1031510321

1031610322
There are three components to a node-oracledb connection:
1031710323

1031810324
1. The memory structure in node-oracledb that is returned by a
10319-
`getConnection()` call. It may be stored in a connection pool.
10325+
`getConnection()` call. It may be a standalone connection or stored in a
10326+
connection pool.
1032010327

1032110328
2. The underlying network connection between the Oracle Client libraries and the database.
1032210329

@@ -10325,17 +10332,19 @@ There are three components to a node-oracledb connection:
1032510332
Node-oracledb connections may become unusable due to network dropouts, database
1032610333
instance failures, exceeding user profile resource limits, or by explicit
1032710334
session closure of the server process from a DBA. By default, idle connections
10328-
in connection pools are unaware of these changes, so a `pool.getConnection()`
10329-
call could successfully return a connection to the application that will not be
10330-
usable. An error would only occur when calling `connection.execute()`, or
10331-
similar.
10332-
10333-
Disable any firewall that is killing idle connections. Also disable the
10334-
database [resource manager][101] and any user resource profile
10335-
[`IDLE_TIME`][100] setting so they do not terminate sessions. These issues can
10336-
be hidden by node-oracledb's automatic connection re-establishment features so
10337-
it is recommended to use [AWR][62] to check the connection rate, and then fix
10338-
underlying causes.
10335+
(the memory structures) in connection pools are unaware of these events. A
10336+
subsequent `pool.getConnection()` call could successfully return a "connection"
10337+
to the application that will not be usable. An error would only occur when
10338+
later calling functions like `connection.execute()`. Similarly, using a standalone
10339+
connection where the network has dropped out, or the database instance is
10340+
unavailable, will return an error.
10341+
10342+
To avoid the overhead of connection re-creation, disable any firewall that is
10343+
killing idle connections. Also disable the database [resource manager][101]
10344+
and any user resource profile [`IDLE_TIME`][100] setting so they do not
10345+
terminate sessions. These issues can be hidden by node-oracledb's automatic
10346+
connection re-establishment features so it is recommended to use [AWR][62] to
10347+
check the connection rate, and then fix underlying causes.
1033910348

1034010349
With Oracle Client 19c, [`EXPIRE_TIME`][159] can be used in
1034110350
[`tnsnames.ora`](#tnsnames) connect descriptors or in [Easy Connect
@@ -11178,8 +11187,9 @@ Output is the same as the previous non-resultSet example.
1117811187

1117911188
Each ResultSet should be closed when it is no longer needed.
1118011189

11181-
Warning: You should not concurrently fetch data from nested
11182-
cursors in different data rows because this may give inconsistent results.
11190+
Warning: You should not concurrently fetch data from nested cursors, for
11191+
example with `Promise.all()`, in different data rows because this may give
11192+
inconsistent results.
1118311193

1118411194
#### <a name="querymeta"></a> 16.1.6 Query Column Metadata
1118511195

@@ -16826,7 +16836,7 @@ Node-oracledb's [`execute()`](#execute) and
1682616836
[`queryStream()`](#querystream) methods use the [Oracle Call Interface
1682716837
statement cache][61] to make re-execution of statements efficient.
1682816838
This cache removes the need for the separate 'prepare' or 'parse'
16829-
method which is sometimes seen in other Oracle APIs: there is no
16839+
methods which are sometimes seen in other Oracle APIs: there is no
1683016840
separate method in node-oracledb.
1683116841

1683216842
Each non-pooled connection and each session in the connection pool has
@@ -16846,6 +16856,15 @@ reused. For example if there are more distinct statements than cache
1684616856
slots, and the order of statement execution causes older statements to
1684716857
be flushed from the cache before the statements are re-executed.
1684816858

16859+
Disabling the statement cache may also be useful in test and development
16860+
environments where database schema objects are being recreated, or where
16861+
identical query text is used with different `fetchAsString` or `fetchInfo` data
16862+
types. Doing so can lead to the statement cache becoming invalid, and the
16863+
application receiving various errors, for example *ORA-3106*. After a
16864+
statement execution error is returned to the application, node-oracledb drops
16865+
that statement from the cache. This allows subsequent re-executions of the
16866+
statement using that connection to succeed.
16867+
1684916868
The statement cache size can be set globally with [stmtCacheSize](#propdbstmtcachesize):
1685016869

1685116870
```javascript
@@ -17549,3 +17568,5 @@ can be asked at [AskTom][158].
1754917568
[196]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-C558F7CF-446E-4078-B045-0B3BB026CB3C
1755017569
[197]: https://www.youtube.com/watch?v=PWFb7amjqCE
1755117570
[198]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-951568BF-D798-4456-8478-15FEEBA0C78E
17571+
[199]: https://blogs.oracle.com/oraclemagazine/build-rest-apis-for-nodejs-part-1
17572+
[200]: https://blogs.oracle.com/opal/demo:-graphql-with-node-oracledb

0 commit comments

Comments
 (0)