Home > Net >  What should one prefer while using node-oracledb - Using one connection for all routes or getting co
What should one prefer while using node-oracledb - Using one connection for all routes or getting co

Time:08-29

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?

CodePudding user response:

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.

  • Related