IMD SolutionComputing LibraryShop main store

Explainer

Why the Ignition GAN cannot share a database connection

Edge computing and IIoT Published 8 min read By IMD Solution engineering team

Short answer

The Ignition GAN carries tag providers, alarms, history and messages between gateways, but a database connection is defined per gateway, so a spoke cannot use the hub's connection and store-and-forward will not move rows between two databases. The pattern that keeps TCP 8060 with SSL as the hub's only inbound port is a hub-initiated pull: each spoke exposes a message handler that returns a batched dataset, and the hub tracks a watermark per spoke and table.

On this page
  1. Does the Ignition gateway network carry a database connection?
  2. Why won't store-and-forward or SQL Server Express replication move the rows?
  3. Which transfer path keeps port 8060 as the hub's only inbound port?
  4. How does the hub reach a spoke that has no inbound port?
  5. How do I prove the hub can call a handler on the spoke?
  6. How does a watermark replace store-and-forward?
  7. Can a 5000-row batch keep up with two rows per second and a weekend outage?
  8. How do I confirm the hub copy matches the spoke?
  9. Questions asked

The Ignition gateway network — the GAN — carries tag providers, alarms, history and messages between gateways, but it does not carry database connections. A database connection is defined on one gateway and terminates at that gateway's own JDBC endpoint, so a spoke cannot write through a connection that exists only on the hub, and store-and-forward will not move rows between two separate databases. With SQL Server Express on the spokes, replication and mirroring are closed off as well. The pattern that keeps TCP 8060 with SSL as the hub's only inbound port is a hub-initiated pull: each spoke exposes a message handler that returns a batched dataset, and the hub tracks a watermark per spoke and table. This article shows why each shortcut fails, how the pull is built, and the arithmetic that proves it keeps up.

Does the Ignition gateway network carry a database connection? #

No. The GAN carries remote tag providers, alarm and history services, and gateway messages between gateways, but a database connection is defined per gateway and resolves to that gateway's own JDBC endpoint, so there is no remote database provider to share.

Put a connection name in a script on the hub and the hub looks it up in its own list; the same name in a script on the spoke resolves on the spoke or not at all. Nothing in the GAN tunnels that lookup to another gateway. A feature request for SQL access over the GAN has been filed with the vendor, so check the release notes of the version you run before assuming the gap still exists; everything below assumes it does. If what the hub needs is tag values rather than table rows, the network already covers that case — the same connections behind pulling Edge tags to the main gateway with a remote tag provider are the ones this pull rides on.

Why won't store-and-forward or SQL Server Express replication move the rows? #

Store-and-forward only queues a gateway's failed writes to its own configured connection and flushes them when that same connection recovers, and Microsoft documents SQL Server Express as a replication subscriber only, so a spoke can neither publish to the hub nor host a mirror.

Store-and-forward is a retry cache with one destination, not a transfer service between two live databases. It belongs to the subsystems that own a destination — history providers and transaction groups — and this design uses neither for its tables. The same wall appears on the history side, which is why Edge-to-Central synced history can't fill a custom SQL table. On the SQL side, the roles this design needs are excluded: an Express instance can subscribe to replication but cannot publish or distribute, and it cannot take part in database mirroring beyond the witness role. That leaves scripted paths, and the next question picks one.

Which transfer path keeps port 8060 as the hub's only inbound port? #

Only a hub-initiated pull over gateway messaging keeps TCP 8060 with SSL as the hub's single inbound port, because every SQL-level alternative — replication, mirroring, triggers or a relay — needs a database port or a relay listener reachable from the spokes.

Path Inbound at the hub Catch-up after an outage Verdict
Remote database provider over the GAN none none does not exist as a resource
Hub pull over GAN messaging the GAN port with SSL watermark per spoke and table fits the constraint
SQL Server replication or mirroring database ports native excluded by the Express edition
SQL triggers pushing to the hub the SQL port, 1433 custom logic breaks the one-port rule
SQL relay exposing the hub instance whatever port the relay listens on custom logic reopens a SQL path; verify it against the site policy

For the wider choice among periodic collection routes on the edge side, choosing an edge data path for periodic records covers the alternatives. This article commits to the second row: the spoke keeps writing locally, the hub reaches in over the connection the spoke already opened, and the watermark supplies the catch-up.

How does the hub reach a spoke that has no inbound port? #

The spoke dials out to the hub on TCP 8060 with SSL, and once that connection is established the GAN carries messages in both directions, so the hub can call a message handler on the spoke with no inbound rule at the spoke site.

Only the hub holds an inbound firewall rule; the spoke's session is outbound, and nothing at the spoke site ever listens for the hub. Confirm the link on both ends — the Gateway Network status page on each gateway should show the connection running. When the hub addresses a spoke, it uses the system name shown for that spoke on the hub's Gateway Network page; a wrong name reads as a missing gateway, not a firewall fault. That bidirectional property is the whole reason the pull can live on the hub: the boundary stays one port, one direction of session setup.

How do I prove the hub can call a handler on the spoke? #

Create a gateway message handler on the spoke that returns a fixed value, invoke it from a hub gateway script with system.util.sendRequest, and a returned value proves the whole path before any production data moves.

That scripting function sends a message to a gateway and, unlike the plain send-message call, expects a response — exactly what a data pull needs. Read the outcome: a returned value means transport, certificates and handler registration are all good; a timeout or no-handler error means the project and handler names must match exactly, and the spoke must accept incoming messaging from the hub in its GAN settings. If one spoke answers and another does not, compare their system names and connection states. Where a script must not block on the reply, system.util.sendRequestAsync is the non-blocking variant of the same call.

How does a watermark replace store-and-forward? #

The hub stores one watermark per spoke and table — the highest source key it has committed — requests rows above it in fixed batches, and advances it only after the insert commits, so an outage pauses the pull and the next run resumes where it stopped.

The prerequisite is a monotonically increasing key or timestamp column on each source table; without one, new rows cannot be told from old. On the spoke, the message handler runs a prepared query above the supplied watermark, ordered by key and capped at the batch size. On the hub, a gateway timer script loops over the spokes, inserts the returned rows, and updates the watermark in the same transaction as the insert. Add a unique constraint on spoke identifier plus source key at the hub, so a repeated batch cannot store duplicates. Within one timer run, keep requesting while a batch comes back full, and stop on the first short batch.

# Spoke: gateway message handler 'pullReadings' in project 'DataHub' (example names)
lastKey = payload['lastKey']   # watermark from the hub, e.g. 120500
batch   = payload['batch']     # rows per request, the batch size
return system.db.runPrepQuery(
    'SELECT TOP (?) * FROM dbo.Readings WHERE Id > ? ORDER BY Id',
    [batch, lastKey], 'SpokeLocal')   # the spoke's own connection (example name)
# Hub: gateway timer script, one pass for one spoke (example names)
wm = 120500   # watermark read from the hub's watermark table for SpokeA (example)
ds = system.util.sendRequest('DataHub', 'pullReadings',
    {'lastKey': wm, 'batch': 5000}, remoteServer='SpokeA')
# insert the returned rows into the hub table, then update the
# watermark in the same transaction; repeat while the batch came back full

The spoke keeps writing to its local instance throughout; the handler only reads. Because the hub initiates every request, a dropped link simply freezes the watermark — the catch-up you wanted from store-and-forward, for as long as the spoke retains the rows.

Can a 5000-row batch keep up with two rows per second and a weekend outage? #

Yes: a spoke writing 2 rows per second adds 172,800 rows per day, so a 60-second timer cycle brings 120 new rows against a 5,000-row batch, and the 345,600-row backlog of a 48-hour outage clears in 70 requests, about 140 seconds at 2 seconds per request.

The arithmetic, step by step:

  • Steady state: 2 rows/s × 86,400 s per day = 172,800 rows per day. One timer cycle: 2 rows/s × 60 s = 120 rows, far below the batch, so a single request per cycle keeps the spoke clear.
  • Catch-up: 48 h × 3,600 s/h × 2 rows/s = 345,600 rows. 345,600 ÷ 5,000 = 69.1, so 70 requests. 70 × 2 s = 140 s to catch up once the link returns.
  • Ceiling per spoke: one request delivers at most 5,000 rows in 2 s, so a sequential pull sustains 2,500 rows/s in theory; plan on a fraction of that and measure the real round trip on site.
  • Retention: 30 days at this rate is 30 × 172,800 = 5,184,000 rows; set the spoke's purge job no shorter than the longest outage you intend to recover from.

The decision: for a few hundred rows per second per spoke, commit to this pull with that batch size and timer period. If a spoke runs hotter, split the pull across tables or issue the requests with the asynchronous call, then re-measure before raising the rate.

How do I confirm the hub copy matches the spoke? #

Compare the row count and the maximum key on both sides: once the pull has caught up, the hub's count for that spoke equals the spoke's own count, and the hub's maximum key equals the stored watermark.

Record the count and maximum key on the spoke table, then run the same pair on the hub table filtered by that spoke's identifier. Counts only agree while the spoke is quiet, so compare the maximum keys first — equal maxima with the timer idle mean the copy is current. Then drill it, on a test spoke or in a window when hub reports may lag: break the GAN link for several timer cycles, insert test rows at the spoke, restore the link, and confirm the hub catches up with no gaps and no duplicates. The watermark forbids gaps, the unique constraint forbids duplicates. When that drill passes, the pull is production-ready: one inbound port, one watermark per spoke, and a copy you can prove on demand.

Questions asked

Can the watermark be a timestamp column instead of an identity key?

Yes, if the values never repeat and never move backwards. A strictly-greater-than query skips rows that share the watermark's exact timestamp, so order by a tiebreaker as well, or key the pull on an identity column and keep the timestamp for reporting. A clock adjustment on the spoke is the usual way a timestamp watermark breaks.

What happens to rows updated at the spoke after they were pulled?

Nothing, and that is the trap: the pull copies inserts only, so an updated row below the watermark is never re-sent and the hub keeps the old version. If updates matter, maintain a last-modified column, pull by that column into a staging table, and overwrite the hub rows by source key in the transaction that advances the watermark.

How many spokes can one hub timer script serve?

Budget it from the round trip. The loop is sequential, so ten spokes at 2 seconds each occupy 20 seconds of a 60-second timer and still leave room for catch-up loops. Past roughly half the timer period, move the remaining spokes to a second timer script or issue the calls with the asynchronous variant so a slow spoke cannot delay the rest.

Does the pull load the spoke's SQL Server Express instance?

One indexed range read per request. With the key column as the primary key, the engine seeks straight to the watermark and reads forward for one batch, so at the example rate it is a single small read each minute. Local writes and reporting on the spoke continue unchanged, because the handler only reads above the watermark.

Can one handler serve several tables per spoke?

Yes. The hub keeps one watermark row per spoke and per table, and the handler either takes the table name from a fixed allow-list that the script checks before building the query, or you register one handler per table. Never splice a caller-supplied table name straight into the SQL string.

Keep reading

  • How-to

    Pull Ignition Edge tags to the main gateway with a remote tag provider

    Create a Remote Tag Provider on the main gateway that links, over a Gateway Network connection, to the tag provider on the Ignition Edge gateway, and leave the PLC device connection on the Edge side of the wireless link. The hop then carries tag subscriptions between the gateways instead of the PLC poll. Initiate the connection from the Edge side when NAT blocks the reverse direction.

    Edge computing and IIoT

  • Explainer

    Why PI Server cannot receive Historian alarms and events

    The PI Data Archive holds timestamped values per tag, so the Historian publisher disables alarms and events for a PI Server destination; no controller or tag change enables it. Keep time-series replication on the native path and carry alarm occurrences through a PI interface or a checkpointed extraction.

    Edge computing and IIoT

  • Explainer

    HMI without SQL client: put the database writes on an edge PC

    The greyed-out SQL Query is the model's feature set, not a project setting: EasyBuilder Pro lists its supporting models in the manual's appendix, and no option or update adds the function to an unsupported panel. Keep the HMI as the operator interface and give the SQL session to one edge box PC, gateway or PC-based SCADA host, using a handshake where one PLC request yields one transaction and one completion.

    Edge computing and IIoT

Automate daily PI message log collection with pigetmsg