This is in reaction to http://www.madhur.co.in/blog/2016/09/05/nodejs-connection-pooling.html
It is critical that you remember to release connections to the pool if you are using pooling with the mysql module.
It is best to use the pool.query()
command if you can.
You’ll know if you can’t.
Examples of things which cannot use pool.query()
but must use pool.getConnection()
followed by connection.release()
are:
- Using transactions where you send multiple commands to the server.
- Sharing per-session data objects between subsequent commands sent to the server such as temporary tables.