# How to restart SQL Server from the PLC

**URL:** <https://forum.inductiveautomation.com/t/how-to-restart-sql-server-from-the-plc/68745>\
**Category:** Ignition\
**Created:** [January 18, 2023, 6:08pm UTC](https://forum.inductiveautomation.com/t/how-to-restart-sql-server-from-the-plc/68745 "2023-01-18T18:08:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lei\_Qu](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@Lei\_Qu](https://forum.inductiveautomation.com/u/Lei_Qu)\
**Post date:** [January 18, 2023, 6:08pm UTC](https://forum.inductiveautomation.com/t/how-to-restart-sql-server-from-the-plc/68745/1 "2023-01-18T18:08:16Z")

</div>

Hi Experts,

May I ask how to restart a SQL Server in my PLC application? For some reason, sometimes if the SQL server side is reset, it may cause the client end to lose connection to it. After the reset is done, I still don't valid connection to a database. Then I have to restart the SQL server as shown in the picture.

I am wondering if they is control in Ignition some where that allow me restart a SQL server.

Thanks.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/7/a73b04571d4356977c51a0e129a7e4a7f0632275.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 18, 2023, 6:28pm UTC](https://forum.inductiveautomation.com/t/how-to-restart-sql-server-from-the-plc/68745/2 "2023-01-18T18:28:50Z")

</div>

No, not natively from Ignition. Ignition only knows JDBC, and there doesn't appear to be a SQL statement that tells SQL server to restart.

Something using java's `ProcessBuilder`, a set of secure shell keys, and a PowerShell script in the SQL Server's host machine might do the trick.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [January 18, 2023, 7:38pm UTC](https://forum.inductiveautomation.com/t/how-to-restart-sql-server-from-the-plc/68745/3 "2023-01-18T19:38:22Z")

</div>

Just for curiosity sake, why is SQL server being reset so much?

---

<div class="post-metadata">

**Author:** ![Lei\_Qu](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@Lei\_Qu](https://forum.inductiveautomation.com/u/Lei_Qu)\
**Post date:** [January 18, 2023, 8:05pm UTC](https://forum.inductiveautomation.com/t/how-to-restart-sql-server-from-the-plc/68745/4 "2023-01-18T20:05:42Z")

</div>

No it's not often. Right now in development phase may be it is more. However in production phase even one reset a month or even longer might cause an issue.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [January 18, 2023, 8:17pm UTC](https://forum.inductiveautomation.com/t/how-to-restart-sql-server-from-the-plc/68745/5 "2023-01-18T20:17:52Z")

</div>

Your title says, "How to restart SQL Server from the PLC?" but you are really asking "How to restart SQL from an Ignition application or from the Ignition gateway?" Maybe you should edit your question title?
