Settings to Connect a PLC to SQL Server

Tested on:

All links open in new tab. Use them in case you don’t have the necessary software installed.

Jump to

Check if SQL Server allows SQL Authentication

Open SQL Server Management Studio (you can just type SSMS on Windows start). If it’s not installed you can get it free from Microsoft (or search SSMS download on Google, make sure you get it from a Microsoft website).

Connect to the desired server. After the connection is established, right-click on the server’s name and select Properties. Select Security and make sure the SQL Server and Windows Authentication mode is checked.

You will be informed that some changes need server restart in order to take effect. To do so, right-click again on server’s name and select Restart. Answer Yes to next two messages.

Create a SQL user

To create a new user, expand Security from the server tree, right-click on Logins and select Add new login.

On the General tabs, fill in the user and password, check SQL Server authentication and un-check Enforce password expiration. On the bottom of the page, select the database you want this new user to connect by default. If it’s now created yet, you can leave it as it is, master.

Now, on the Server Roles tab, check sysadmin.

Test your new user:

  • disconnect the server
  • connect again, using this time SQL Server authentication, the new user and its password.

TCP/IP and Port settings

On Windows Start type Computer Management (or you can find it on Control Panel\All Control Panel Items\Administrative Tools). All settings will be done here.

Under Services and Applications, find Protocols for SQLExpress. If TCP/IP is disabled, right-click on it and select Enable. Click OK to the notification that a server restart is needed.

Now set the port: double-click on TCP/IP, select IP Settings tab and scroll down to IPAll. Here, delete any value from TCP Dynamic Ports and type 1433 to TCP Ports. Click OK and OK.

Final step, restart the SQL server: On the left side of the Computer Management go a bit up and click on SQL Server Services. On the right side, right-click on SQL Server (SQLEXPRESS) and select restart. Wait until stop and start dialogs disappear.

Firewall settings

On the start button type “firewall” and then click on the Windows Defender Firewall. Right-click on Inbound and select New Rule.

Rule type: choose Custom.

Protocol and Ports: select Protocol type TCP and Remote port 1433 – the port you chose for SQL Server communication.

Scope: Here you specify the IP of the PLC as the remote IP. Click Add and type it. If more than one PLC, use Add button to add them all.

Click Ok and go to Name and define a meaningful name for this rule, like PLC-to-SQL connection.

That’s all, now you should be able to connect your PLC to the SQL database.


  1. Hi Experts
    I do it as your guide, but My PC (SQL) still cannot connect to PLCs.
    Can you show me any mistake

  2. Hi Dat,

    Could you please give more details?

    These settings need to be done on the computer that holds the SQL server.
    Then, the connection depends on the PLC software. Which one are you using?

    Please note that the SQL server computer should have a static IP if you are accessing it through internet.

    If you are using Visu+ check this one
    For PC Worx check
    For e!Cockpit see

    If you are using another software let me know which one so I can try myself.

  3. It also need to enable UDP 1434 to avoid SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified

  4. I have worked through the example but I’ve seen that each PLC requires a licence for this PC WORX function block. Is there any other way to capture or view the process data from a ILC151 controller over ethernet. Writing a program to insert them into the database would not be an issue, my main issue is viewing these variables over ethernet.

    Thank you in advance,

  5. I need to move 120 data items (strings, floats and integers) from an Automation Direct Productivity PLC to a SQL table. How much is your software per machine? I have 25 that would need a PLC to SQL solution.

  6. Hi Bruce,

    I do not sell any software, this website is just showing some solutions I found myself. You would need to check the manufacturer’s documentation to see how to transfer data to SQL. Each manufacturer has its own software and dedicated libraries that usually are a bit (or more) different.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.