# Mssql plus connection is closed/timeout

**URL:** <https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389>\
**Category:** General\
**Created:** [24 June 2023 11:33 UTC](https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389 "2023-06-24T11:33:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [24 June 2023 11:33 UTC](https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389/1 "2023-06-24T11:33:20Z")

</div>

Hi ,

I have a flow which triggers a bunch of 15-20 messages at the same time.  
They all go through the same flow. And hit the mssql node.  
I keep running into connect closed/ connection timeout from MSSSQL Plus node.

I have increased the connection pool to 50. But it doesnt help.

If i add a delay between the messages - then everything works .

1. Is this a know issue ?
2. Any recommendations how to overcome ?
3. If the only option is adding a delay - then any recommendations on delay time ?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 June 2023 11:52 UTC](https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389/2 "2023-06-24T11:52:22Z")

</div>

> [@SandeepA](#):
>
> Is this a know issue

Yes and no.

Is this an azure dB or a full SQL server or SQL express?

It is possible you are exceeding max concurrent queries.

One method would be to queue all your queries in a stack, and only release the next one after SQL server has finished.

Another would be to do multiple queues in one transaction.

Another way would be to use a semaphore to only permit 1 SQL exec at a time.

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [24 June 2023 11:58 UTC](https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389/3 "2023-06-24T11:58:08Z")

</div>

> [@Steve-Mcl](#):
>
> Is this an azure dB or a full SQL server or SQL express?

Full SQL Server - Developer edition.

> [@Steve-Mcl](#):
>
> One method would be to queue all your queries in a stack, and only release the next one after SQL server has finished.
> 
> Another would be to do multiple queues in one transaction.
> 
> Another way would be to use a semaphore to only permit 1 SQL exec at a time.

Isnt 1st and 3rd option kind of same ?  
(2nd option doesnt work for me - since i have different flows which need to do different things ).

Does this mean will be able to run only 1 transaction at a time ? irrespective of the number of flows i try to run in parallel ?  
That would create for me at least serious performance issue with flows waiting at SQL node.

Would you know why this happens ?

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [25 June 2023 10:52 UTC](https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389/4 "2023-06-25T10:52:10Z")

</div>

Hi @Steve-Mcl ,  
Do you know if there is a way to close the connection after each query (move to stateless mode, i.e. each new query will open/close its own connection)?

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [26 June 2023 12:42 UTC](https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389/5 "2023-06-26T12:42:55Z")

</div>

Any suggestions ? Anyone ?

---

<div class="post-metadata">

**Author:** ![SandeepA](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sandeepa/32/63225_2.png) [@SandeepA](https://discourse.nodered.org/u/SandeepA)\
**Post date:** [3 July 2023 16:39 UTC](https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389/6 "2023-07-03T16:39:48Z")

</div>

Hi - Any help on this will be appreciated. Is it a node issue / SQLS issue - not clear.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 September 2023 16:40 UTC](https://discourse.nodered.org/t/mssql-plus-connection-is-closed-timeout/79389/7 "2023-09-01T16:40:19Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
