# Connection to the database disappears after node js reboot

**URL:** https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619
**Category:** General
**Created:** [17 December 2020 07:02 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619 "2020-12-17T07:02:44Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Aklex1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aklex1/32/19306_2.png) [@Aklex1](https://discourse.nodered.org/u/Aklex1)
#### Post date: [17 December 2020 07:02 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619/1 "2020-12-17T07:02:44Z")

</div>

when the server with node red is rebooted, the data for connecting to the sql database will disappear - the user and password, has anyone encountered this problem?

 ![sql](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/1613704c4b3b95eeec8f0cc5ab666b86ca3d3fc7.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 December 2020 07:28 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619/2 "2020-12-17T07:28:15Z")

</div>

What version of node red and nodejs are you using?  
Is there anything unusual about your setup?  
What OS are you running and how did you install node red?  
Are you able to deploy changes to the flow?

Please start node red in a terminal, enter the credentials and deploy it, then restart node red. Then post the startup log here.

---

<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: [17 December 2020 07:37 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619/3 "2020-12-17T07:37:36Z")

</div>

@Aklex1, That looks like the old& no longer supported MSSQL node.

I strongly recommend [mssql-plus](https://flows.nodered.org/node/node-red-contrib-mssql-plus) version as it has numerous big fixes and supports stord procedures & parameters (& therefore protection against SQL injection) & much more.

---

<div class="post-metadata">

### Author: ![Aklex1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aklex1/32/19306_2.png) [@Aklex1](https://discourse.nodered.org/u/Aklex1)
#### Post date: [17 December 2020 07:38 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619/4 "2020-12-17T07:38:35Z")

</div>

node red 1.0.3  
windows server 2012

Is there anything unusual about your setup?  
i am use PM2 for demon process  
node js can not find out now and the launch log of node red  
Are you able to deploy changes to the flow? do not quite understand

---

<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: [17 December 2020 07:44 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619/5 "2020-12-17T07:44:05Z")

</div>

> [@Aklex1](#):
>
> Are you able to deploy changes to the flow? do not quite understand

Can you deploy other changes to your flow& do they stay there after a reboot. This question is to determine if your file system is writable etc.

What node version are you running? (Run `node -v` in a command terminal)

Ps, as you are running under pm2, the console will be logged & saved to file, can you locate that & look for clues & post the first 50 lines or so until you see node-red is running.

---

<div class="post-metadata">

### Author: ![Aklex1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aklex1/32/19306_2.png) [@Aklex1](https://discourse.nodered.org/u/Aklex1)
#### Post date: [17 December 2020 08:14 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619/6 "2020-12-17T08:14:18Z")

</div>

> [@Steve-Mcl](#):
>
> Can you deploy other changes to your flow& do they stay there after a reboot. This question is to determine if your file system is writable etc.
> 
> What node version are you running? (Run `node -v` in a command terminal)
> 
> Ps, as you are running under pm2, the console will be logged & saved to file, can you locate that & look for clues & post the first 50 lines or so until you see node-red is running.

 ![sq2l](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/0/b002cacb7ab300b6a0b91291630d069ac55a8f91.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 December 2020 09:17 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619/7 "2020-12-17T09:17:53Z")

</div>

In future please copy/paste logs here if possible rather than screenshot, it makes it easier to access. Use the `</>` button at the top of the forum entry window when pasting it in.  
The address in use problem is almost certainly because you have not stopped the running version of node-red before starting another instance.  
I see that you are using an old version of node-red and an unsupported version of nodejs (13.5.0) so I suggest changing to nodejs 12 or 14 and upgrading node-red. Also, if you have not already, switch to the alternative mssql node as suggested and then try again.

---

<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: [15 February 2021 09:18 UTC](https://discourse.nodered.org/t/connection-to-the-database-disappears-after-node-js-reboot/37619/8 "2021-02-15T09:18:09Z")

</div>

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