What should one prefer while using node-oracledb – Using one connection for all routes or getting connection from pool for each route and then close?

Issue

I am working on a node-express project and wanted to have a guide on what is more preferable
Using one database connection for all routes or getting connection from pool for each route and then closing it?

Solution

You want to use a connection pool, because while one connection is busy by receiving or sending data, another can be used from the pool and perform more work. Thus, it improve overall performances.

It’s something you can’t do with only one connection.

You create your pool when program start, then request a connection in your route and release it when the route have done its work.

Answered By – Ariart

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published