jeudi 2 janvier 2020

node js for each dataset, connect database, perform select, update, insert query asynchronously

I am working on testcafe, in one of the data-driven test cases, for each test case, I am performing below set of database operations, connect, select, update, insert, close connection. The issue is when I execute forEach loop with only one dataset, it works well when I have multiple datasets, it fails with below error -

ConnectionError: Already connecting to database! Call close before connecting to different database. at ConnectionPool._connect (C:\javelin\node_modules\mssql\lib\base.js:238:37) at PromiseLibrary (C:\javelin\node_modules\mssql\lib\base.js:220:19) at new Promise () at ConnectionPool.connect (C:\javelin\node_modules\mssql\lib\base.js:219:12) at C:\javelin\tests\order-scoring\order-scoring-promisified.js:49:44 at new Promise () at new F (C:\javelin\node_modules\core-js\library\modules_export.js:36:28) at Request. (C:\javelin\tests\order-scoring\order-scoring-promisified.js:48:20) at Generator.next () at step (C:\javelin\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)

Aucun commentaire:

Enregistrer un commentaire