File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -7314,12 +7314,15 @@ async function run() {
7314
7314
let pool;
7315
7315
7316
7316
try {
7317
+ // Typically a pool is created only when the application starts
7317
7318
pool = await oracledb.createPool({
7318
7319
user : "hr",
7319
7320
password : mypw // mypw contains the hr schema password
7320
7321
connectString : "localhost/XEPDB1"
7321
7322
});
7322
7323
7324
+ // Typically there would be multiple pool.getConnection() / connection.close() calls
7325
+ // on a pool before the pool is closed.
7323
7326
let connection;
7324
7327
try {
7325
7328
connection = await pool.getConnection();
@@ -7336,10 +7339,13 @@ async function run() {
7336
7339
}
7337
7340
}
7338
7341
}
7342
+
7339
7343
} catch (err) {
7340
7344
console.error(err.message);
7341
7345
} finally {
7342
- await pool.close();
7346
+
7347
+ // At the end of the application, the pool can be closed
7348
+ await pool.close(0); // close pool immediately
7343
7349
}
7344
7350
}
7345
7351
You can’t perform that action at this time.
0 commit comments