Skip to content

Commit 167e708

Browse files
committed
Adjust wording on terminate() to match behavior. Temporarily remove terminate() from example
1 parent 3239a00 commit 167e708

File tree

2 files changed

+11
-27
lines changed

2 files changed

+11
-27
lines changed

doc/api.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,8 @@ The Pool object obtains connections to the Oracle database using the
610610
is created for each Pool object.
611611

612612
After the application finishes using a connection pool, it should
613-
terminate the connection pool by calling the `terminate()` method on the
614-
Pool object.
613+
release all connections and terminate the connection pool by calling
614+
the `terminate()` method on the Pool object.
615615

616616
### <a name="poolproperties"></a> 4.1 Pool Properties
617617

@@ -726,10 +726,9 @@ This call terminates the connection pool.
726726

727727
This is an asynchronous call.
728728

729-
All open connections in a connection pool are closed when a connection
730-
pool terminates.
731-
732-
Any ongoing transaction in a connection will be released.
729+
Any open connections should be released with [`release()`](#release)
730+
before `terminate()` is called, otherwise an error will be returned
731+
and the pool will be unusable.
733732

734733
##### Prototype
735734

@@ -1007,16 +1006,18 @@ returned as an array. If `bindParams` is passed as an object, then
10071006
Releases a connection. If the connection was obtained from the pool,
10081007
the connection is returned to the pool.
10091008

1010-
1011-
10121009
##### Description
10131010

10141011
This is an asynchronous call.
10151012

1013+
Note: calling `release()` when connections are no longer required is
1014+
strongly encouraged. Releasing helps avoid resource leakage and can
1015+
improve system efficiency.
1016+
10161017
When a connection is released, any ongoing transaction on the
10171018
connection is rolled back.
10181019

1019-
Note that after releasing a connection to a pool, there is no
1020+
After releasing a connection to a pool, there is no
10201021
guarantee a subsequent `getConnection()` call gets back the same
10211022
database connection. The application must redo any ALTER SESSION
10221023
statements on the new connection object, as required.
@@ -1084,8 +1085,7 @@ A SQL or PL/SQL statement may be executed using the *Connection*
10841085
statements are not committed unless the `commit()` call is issued or
10851086
the `isAutoCommit` property is *true* at the time of execution. Any
10861087
ongoing transaction will be rolled back when [`release()`](#release)
1087-
or [`terminate()`](#terminate) are called, or when the application
1088-
ends.
1088+
is called, or when the application ends.
10891089

10901090
Using bind variables in SQL statements is recommended in preference to
10911091
constructing SQL statements by string concatenation. This is for

examples/webapp.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
*
3030
* Uses Oracle's sample HR schema.
3131
*
32-
* The connection pool should not be terminated as long as the server is up.
33-
*
3432
*****************************************************************************/
3533

3634
var sys = require('sys');
@@ -139,20 +137,6 @@ oracledb.createPool (
139137
});
140138
});
141139

142-
process.on('SIGTERM', function () {
143-
console.log('Received SIGTERM');
144-
pool.terminate(
145-
function(err)
146-
{
147-
if (err) {
148-
console.error('terminate() callback: ' + err.message);
149-
process.exit(0);
150-
}
151-
console.log('Closed Oracle connection pool');
152-
process.exit(0);
153-
});
154-
});
155-
156140
hs.listen(portid, "localhost");
157141

158142
sys.puts("Server running at http://localhost:" + portid);

0 commit comments

Comments
 (0)