I'm using a PLC connected to a laptop (over EthernetIP). The development software for programming the PLC has a built in settings page for connecting it to various database engines (MySQL, PostgreSQL, MS SqlServer). It's an easy form where you fill in the IP address, port number (not required), database name, username, password.

I installed SqlServer 2017 Express on the laptop, and found on internet how to enable the TCP protocol, set a fixed IP address, and switched off dynamic ports. I set the TCP Port to 1433. I filled in the database connection information in the PLC software and it worked. Connection was established and the PLC could execute queries.

The things I did are based on the accepted answer of this question: I can't connect to my servers SQL database via an IP Address

A week later, I was not busy with any activities about the database. I connected another device and had to change the IPv4 settings of the network adapter of the laptop (to change IP range). After setting the adapter settings to the original values, removed the extra device, and become busy with the database again, the PLC couldn't connect to SqlServer anymore. I'm pretty sure the situation is the same as before, but even after following all steps again, the PLC says it can't connect to the db. I tried a ping to the IP address of SqlServer, but I got a response from my network card: Destination host not reachable. Request time-out.

Could it be I still forgot to set something back. Or could it have something to do with changing the adapter settings of the network card?

I did not forget to restart the Sql Server service every time I made a change.

  • It sounds like a network issue. Have you tried changing the IP address of your laptop back to the other range? That said, it's not uncommon for organizations to turn off ICMP (ping) by default through group policy, make sure that it's open on your laptop. – Jonathan Fite Jan 21 at 18:01
  • Yes the range is set back. Also, the laptop and the PLC must be in the same range to be able to connect and use it's programming software. The IP configured in the SQLServer is also in that same range. ping at least works when I ping to the PLC. And also forgot to mention there's no active firewall/virus scanner. – user2190492 Jan 21 at 18:05
  • You could try to reset TCP/IP connections. thewindowsclub.com/reset-tcp-ip-internet-protocol – McNets Jan 21 at 18:12
  • It sounds like the machine running SQL Server is using DHCP to obtain its IP address. Most of the time, when DHCP is used like that, quite often the client will get a different IP address, which would explain why the PLC can no longer connect to the server via the old IP address. If you have a DNS server on the network, you may be able to use the name of the laptop in the PLC database-server field instead of the IP address. – Max Vernon Jan 21 at 19:47

To confirm connectivity, open up SQL Management Studio and try connect to the IP you assigned in SQL. If that connects, then you know SQL is fine, it a issue between the PLC and SQL. If you cannot connect, then you know that it is a SQL/IP issue. Confirm no other clients are using the IP You assigned to SQL, Ensure network discovery is turned on. You mention no firewalls. Have you turned off your Windows firewall? If not allow, port 1433 through. Given the week later, it sounds like a IP Lease expired and another client took the IP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.