Skip to main content

πŸ—„ SQL Connections: Live Data From Your MES, ERP, and Databases

How SQL Connections bring live values from your MES, ERP, LIMS, and historian databases onto your Production Entities β€” and what setup looks like.

Written by Alex Merkin

πŸ“Œ What Is a SQL Connection?

Some of the most valuable data in your factory isn't on the machines β€” it's in a database. Your MES stores test results. Your ERP stores work orders and material status. Your LIMS stores lab measurements. Your historian may have a SQL view that aggregates years of equipment data.

A SQL Connection in Next Plus brings that data onto your Production Entities β€” so the latest test result, current work order status, or last lab measurement is visible on the same screen your operators already use.

No more flipping between systems. No more "I'll check the ERP and get back to you." The answer is there, refreshed every few seconds.


🏭 When Does SQL Fit?

SQL is the right choice when:

  • The data already lives in a database your team trusts β€” MES, ERP, LIMS, custom app, historian SQL view

  • You want the latest value of a record (last test result, current order status, latest lab measurement) β€” not a live equipment feed

  • The data is business-level rather than equipment-level (cycle time, batch status, QA verdict)

  • 10-second freshness is good enough β€” that's how often Next Plus checks the database

SQL connections work with MariaDB / MySQL and Microsoft SQL Server β€” the two most common databases in manufacturing IT.


πŸ›  How SQL Connections Work

In plain terms:

  1. You add the server β€” Next Plus connects to your database with a read-only user your DBA provides

  2. You write a query for each datapoint β€” for example, "give me the latest QA result for serial number X". You write it once, then reuse it across any Production Entity that needs it.

  3. Next Plus polls every 10 seconds β€” it runs your query, takes the latest row, and shows the value on the PE

  4. The value lands on the PE β€” visible on dashboards, available for triggers, logged for history

Unlike a PLC (which pushes values the moment they change), a database has to be asked. Next Plus asks every 10 seconds. For business-level data like "latest test result" or "current order status," that's plenty.


πŸ”’ Security

Read-only, always β€” and enforced three different ways. Your DBAs will appreciate this.

  • Every query is checked at save time. Anything that looks like a write β€” INSERT, UPDATE, DELETE, DROP, ALTER, and similar β€” is rejected before it ever runs.

  • At runtime, queries run in a read-only transaction. The database itself enforces it.

  • We recommend a read-only database user. Your DBA creates a user with SELECT permission on only the tables and views Next Plus needs β€” nothing else.

Next Plus also supports TLS for both MariaDB and MSSQL β€” so credentials and data are encrypted in transit. Configure it through the Additional Connection Options field on the server.


🏭 Common Scenarios

πŸ§ͺ Latest QA Result On The Line

Before: When QA finished testing a batch, the line had to wait for an email or a phone call.

After: A SQL connection pulls the latest QA verdict from the LIMS every 10 seconds. The result shows up on the workstation's Production Entity automatically.

β†’ Outcome: No waiting on emails, faster batch release, one source of truth.


πŸ“‹ Live Work Order Status From The ERP

Before: Operators couldn't see what the ERP said about the order they were running. Planning and the floor were sometimes out of sync.

After: SQL reads the current order status from the ERP database onto the Production Entity. If the order gets put on hold upstairs, the line sees it within seconds.

β†’ Outcome: Fewer wrong-order runs, less back-and-forth with planning.


πŸ”¬ Last Lab Measurement Per Batch

Before: Stability and release data lived in the LIMS and was reviewed by QA in a separate workflow.

After: SQL pulls the latest stability result per batch onto the batch's Production Entity. Anyone working that batch sees it.

β†’ Outcome: Trend issues caught earlier, smoother release process.


πŸ’‘ Real-Life Examples By Industry

πŸ₯ Medical Devices

Use Case 1: Batch Release Status From QA Database

Before: Release decisions waited on QA emailing the final report.
​Connection: SQL pulls the latest QA verdict for the active lot onto the Production Entity.
​Benefits:

  • βœ… Release status visible in real time

  • βœ… ISO 13485 traceability built in

  • βœ… Faster device release

Use Case 2: Sterilization Run History From ERP

Before: Operators couldn't see how many sterilization cycles a chamber had handled this week without asking maintenance.
​Connection: SQL reads cycle counters from the ERP database.
​Benefits:

  • βœ… Predictive maintenance based on real use

  • βœ… Better chamber utilization

  • βœ… No more chasing maintenance for numbers

πŸ§ƒ Food & Beverage

Use Case 1: Supplier Lab Result Lookup

Before: Incoming-material test results lived in the QC database; the line couldn't see them without logging in.
​Connection: SQL pulls the latest result for the active ingredient batch onto the Production Entity.
​Benefits:

  • βœ… HACCP-aligned material verification

  • βœ… No surprise rejects mid-run

  • βœ… Better shelf-life control

Use Case 2: Last Shift Yield From MES

Before: Yield numbers were reviewed in a separate MES screen after the shift.
​Connection: SQL pulls yield from the MES live onto the line PE.
​Benefits:

  • βœ… Shift performance visible during the shift

  • βœ… Faster reaction to drift

  • βœ… Easier comparisons across lines

✈️ Aerospace & Defense

Use Case 1: SAP Work Order Status

Before: Operators couldn't see SAP's view of the work order they were running.
​Connection: SQL reads the current SAP status from the database onto the line.
​Benefits:

  • βœ… Live ERP-to-floor alignment

  • βœ… Fewer wrong-order runs

  • βœ… Reduced clerical work

Use Case 2: Inspection Pass/Fail History Per Serial Number

Before: When a unit came back for rework, history was spread across multiple databases.
​Connection: SQL pulls the inspection history for the active serial number onto the rework PE.
​Benefits:

  • βœ… Full unit history at a glance

  • βœ… Faster rework decisions

  • βœ… Better audit evidence

πŸ§ͺ Pharma / Cosmetics

Use Case 1: Stability Result Per Batch

Before: Stability data was reviewed weekly by QA.
​Connection: SQL pulls the latest stability result per batch into the batch's PE.
​Benefits:

  • βœ… Daily visibility into stability

  • βœ… Earlier trend detection

  • βœ… Smoother batch release

Use Case 2: Priority ERP Order Status

Before: Planners copied Priority work orders into the line system manually.
​Connection: SQL imports and links open WOs daily.
​Benefits:

  • βœ… Less clerical work

  • βœ… Batch-to-order linkage

  • βœ… Fewer planning delays

πŸ“± Electronics Assembly

Use Case 1: ICT Test Results From MES Database

Before: Functional test results were reviewed in a separate MES screen.
​Connection: SQL pulls the latest pass/fail per serial number onto the Production Entity.
​Benefits:

  • βœ… One screen for the operator

  • βœ… Faster rework decisions

  • βœ… Better serial-level traceability

Use Case 2: Component Inventory Status

Before: Line stoppages from missing components were spotted only when the feeder ran dry.
​Connection: SQL pulls current stock levels for the active BOM from the ERP.
​Benefits:

  • βœ… Early warning of stock-outs

  • βœ… Better changeover planning

  • βœ… Less unplanned downtime


πŸš€ What Setup Looks Like

Setup involves your DBA, your IT, and your CS team. The flow is:

  • Step 1 – Identify what data you need
    "Latest QA result for the active lot." "Current order status." "Last sensor reading." Pick the values your team wants to see on the line.

  • Step 2 – Get a read-only login and the database details
    Your DBA creates a user with SELECT on just the tables Next Plus needs, and gives you the host, port, and database name.

  • Step 3 – Add the server in Next Plus
    From Modeling β†’ Production Entity β†’ SQL Servers, click the red +, pick the engine (MariaDB or MSSQL), enter host/port/database/credentials, and hit Test Connection.

  • Step 4 – Write a query for each datapoint
    For each value you want, write a SELECT that returns the latest row. Your CS team will help you shape it β€” Next Plus has a built-in Test Query button so you can validate before saving.

  • Step 5 – Bind to your Production Entities
    Open a PE, scroll to Parameters, and pick the queries you want from the SQL server. They appear live on the PE.

Want help mapping it out? Contact us via chat and we'll walk through the database access and the queries you'll need.

Did this answer your question?