Introduction
This document will demonstrate how to connect an OMRON NX102-1020 (database model) PLC to a MS SQL Server database. For this document, MS SQL Server 2019 will be used locally on a PC with IP address 192.168.250.50.
Pre-Requisites
Installation of MS SQL Server 2019
Please link any other KB articles or prior knowledge here which are referenced here
Further Reading
https://www.edata.omron.com.au/eData/NJ/W527-E1-12.pdf
Procedure
Step1 - Setting the Network
In the multiview explorer, under Configurations and Setup -> Controller Setup -> Built-in EtherNet/IP Port Settings
Keep default IP address for the OMRON NX102-1020 PLC as :192.168.250.1
Step 2 - SQL Server Configuration
On the Windows PC open SQL Server Configuration Manager
Under SQL Server Services make sure SQL Server (SYSMACDEMO) and SQL Server Browser are both running.
Under SQL Server Network Configuration -> Protocols for SYSMACDEMO make sure TCP/IP is Enabled.
Run SQL Server Management Studio
Connect to your SQL Server in this case SYSMACDEMO
Once connected right click the server and go to Properties
Under Security, make sure Server Authentication uses SQL Server and Windows Authentication mode. Press OK.
Right click Database and add a New Database. Give the database a name in this case SysmacDB
Step 2 - Creating a Table using a New Query
Create a table named OmronDemoTable via a query on SQL Server Management Studio. The table will consist of:
⦁ Product_ID of type INT
⦁ Product_Name of type varchar(50)
⦁ Product_Quantity of type INT
⦁ Batch_Date of type datetime
⦁ Discontinued of type bit
Highlight Tables and add a New Query (Ctrl + N).
Add the following code to create the table with the listed columns and data types then click Execute to run the query to create the table.
In the Object Explorer window click on the refresh button, this will refresh the SysmacDB to include the newly added dbo.OmronDemoTable.
Step 3 - Configuring Database Security and adding the NJ/NX MAC as a User
In the Object Explorer Window under Security -> Logins, right click and add a New Login.
Under General
Login name: OmronNX102
SQL Server Authentication (selected):
Password: Omron2020
User must change password at next login: unticked
Default database: SysmacDB
Under Server Roles, have public and sysadmin ticked.
Under Users Mapping tick the SysmacDB Map box and under Database role membership for: Sysmac DB, make sure db_owner and public are ticked. Click OK