IMD SolutionComputing LibraryShop main store

Troubleshooting

Ignition database user source SQL Server permissions

Edge computing and IIoT Published 6 min read

Short answer

A valid Designer query proves connectivity and SELECT only. In Automatic Mode, Ignition creates and manages the user and role tables itself, so the SQL Authentication login needs CREATE TABLE in the target database plus SELECT, INSERT, UPDATE and DELETE on those tables before the first role or user can be stored. Grant the rights, prove them with a test table, then create a role and a user to confirm.

On this page
  1. Read the failing hop before changing anything
  2. What Automatic Mode asks the login to do
  3. Granting the rights for an Automatic Mode user source on SQL Server
  4. After the grant: retest from the Gateway
  5. Custom mode queries and schema names
  6. End-to-end proof: role first, then user
  7. The decision
  8. Questions asked

The gateway error fires only when you create a role or a user, and that timing is the diagnosis. A Designer query against the same database proves the connection and the login's SELECT right, nothing more. A database user source in Automatic Mode makes Ignition create and manage the user and role tables itself, so the login behind the Gateway database connection must be allowed to create tables in the target database and then read and write them. A SQL Authentication login usually carries only the rights already tested, connect and read, so the first write into a table that does not exist yet fails at the create step. Grant CREATE TABLE plus SELECT, INSERT, UPDATE and DELETE, prove the grant with a test table, and the configuration that just failed works unchanged.

Read the failing hop before changing anything #

The request path runs user source profile, Gateway database connection, JDBC session on SQL Server, then the login's rights inside the target database. Each symptom clears a different slice of that path, so read them in order:

  • The datasource status shows valid: network, port and credentials are good.
  • A Designer query returns rows: SELECT on tables that already exist works.
  • The error fires only when a role or user is added: the first three hops are healthy and the failure sits at CREATE TABLE or the first INSERT.
Observation It proves Still open
Datasource status valid Network, port, credentials Rights inside the database
Designer query returns rows SELECT on existing tables CREATE TABLE, INSERT, UPDATE, DELETE
Error only on adding a role or user Connection healthy The denied statement, named in the log

Open the gateway logs and read the full entry for the failure. A SQL Server permission denial names the action that was refused and the database it was refused in. Record that text before you change anything: the grant you write should match the denial word for word.

What Automatic Mode asks the login to do #

In Automatic Mode Ignition creates and manages the user and role tables for you, and the profile can prefix the table names so several user sources can share one database. The first role you add triggers the CREATE TABLE statements and then an INSERT; adding, editing or removing users exercises INSERT, UPDATE and DELETE on those tables, and every login attempt reads them with SELECT. Custom mode instead runs the queries you define, and those need tables that already exist.

That split decides the grant. In Automatic Mode the login needs the database-level CREATE TABLE right plus SELECT, INSERT, UPDATE and DELETE on the tables it creates, which on SQL Server land in the login's default schema, normally dbo. A valid Designer query clears none of that: it never leaves the SELECT path. The historian connection on the same server faces the same logic with its own right set, and the full six rights for a SQL historian database connection are listed separately. When Ignition's tag historian never creates its tables on that server, the fault is usually the same missing-create-rights class, as covered in why Ignition tag historian tables are not created.

Granting the rights for an Automatic Mode user source on SQL Server #

Inputs for this case:

  • Mode: Automatic, set in the user source profile, the documented mode in which Ignition creates and manages the tables.
  • Authentication: SQL Authentication, so the grants land on the login itself rather than on a Windows group.
  • Target database: one database that already exists; call it scada_auth here, an example name.
  • Login: a dedicated SQL Authentication login mapped as a user in that database; call it plant_auth_login here, an example name.
  • Rights Automatic Mode will exercise: CREATE TABLE, then SELECT, INSERT, UPDATE and DELETE on the tables, five in total.
  • Rights a working Designer query has proven: SELECT, one.

The rule in words: Automatic Mode succeeds only if the login can create the tables and then read and write them. The arithmetic: five rights needed, one proven, four missing, which are CREATE TABLE, INSERT, UPDATE and DELETE. A query result cannot close that gap, because a SELECT never exercises any of the four.

Run the grants in SSMS as an administrator:

USE scada_auth;
CREATE USER plant_auth_login FOR LOGIN plant_auth_login;  -- only if the mapping does not exist yet
GRANT CREATE TABLE TO plant_auth_login;
GRANT SELECT, INSERT, UPDATE, DELETE ON SCHEMA::dbo TO plant_auth_login;

Then prove them as the login itself. Connect to SSMS as plant_auth_login, not as an administrator, and run:

CREATE TABLE dbo.permission_probe (probe_id INT);
INSERT INTO dbo.permission_probe VALUES (1);
SELECT probe_id FROM dbo.permission_probe;
DROP TABLE dbo.permission_probe;

Result: all four statements succeed, which is every action Automatic Mode will ask of the database. Back in the Gateway, the first role creation then lands a row in the newly created roles table.

The decision: if the probe's CREATE TABLE fails under that login, stop and fix the grants before touching the user source, because no Ignition setting overrides a database denial. If the probe passes and the Gateway still denies, the log entry names the one right still missing, and you add exactly that grant.

Membership in db_owner also clears the bar but hands the login far more than a user store needs. db_datareader and db_datawriter replace the schema-level SELECT, INSERT, UPDATE and DELETE grant but carry no CREATE TABLE, so in Automatic Mode they need db_ddladmin or an explicit CREATE TABLE grant beside them.

After the grant: retest from the Gateway #

SQL Server evaluates each statement against the rights in force when it runs, so the new grants apply to the next create without a reconnect. Create a role in the user source now. If the same denial reappears, restart the Gateway's database connection from its configuration page to rule out anything stale in the pool, confirm the status returns to valid, and read the newest log entry: it names a different right when one grant is still missing.

Custom mode queries and schema names #

Custom mode runs the queries the profile defines, so the tables must exist before the first login attempt and the login needs only row access to them. The usual SQL Server trap is the schema: the login's default schema may not be the one holding the tables, so an unqualified table name fails as an invalid object. Qualify every query in the profile, the user lookup, the role lookup and the add, edit and remove statements, with the schema, for example dbo. Run each profile query in SSMS under the same login the Gateway uses; a query that errors there errors in the profile too. Automatic Mode is immune to this trap because it generates its own statements.

End-to-end proof: role first, then user #

  1. Create a role in the user source. The roles table is created and gains its first row.
  2. Create a user and assign that role. The user table gains a row carrying the username, the password hash and the role membership.
  3. Query both tables in SSMS and confirm the two rows.
  4. Log in to a project or the Gateway with that user and confirm the role returns.

Once the role returns, what a session may do is the sum of its roles; how OPC UA role permissions combine across session roles is covered on its own page. To retire an account later, gate it rather than drop the record; the trade-off between a role gate and a never schedule is worked through in deactivating Ignition users.

The decision #

  • Automatic Mode on SQL Server: grant CREATE TABLE on the target database and SELECT, INSERT, UPDATE, DELETE on the schema that holds the tables, prove it with a test table run as that login, then create the role and the user. If the probe fails, no Gateway setting fixes it; the grant does.
  • Custom mode on SQL Server: create the tables ahead of the profile, grant row access only, and schema-qualify every query in the profile.
  • Automatic Mode on SQLite: no grants at all. The store is a local file with no login permission model, which is exactly why this fault waits for the move to SQL Server.

Questions asked

Does a valid Designer query prove the SQL login can create tables?

No. A Designer query is a SELECT against tables that already exist, so it tests credentials and read access only. CREATE TABLE is a separate database-level permission that no read ever touches, which is why the datasource can show valid while the first role creation fails. Prove the create right by running a test table under the same login before you configure the user source.

Why does the same Automatic Mode user source work on SQLite but fail on SQL Server?

SQLite is a local file with no login permission model, so Ignition creates and manages its tables there without any grant. SQL Server checks every statement against the login's rights, so the create step becomes an authorization question. The move also changes what you administer: the store becomes queryable remotely, but migrating it means moving real database objects instead of one file.

Can the login create the database itself?

It can, but that path needs server-level create-database rights, which are broader than a user store should hold. Create the empty database in advance, map the login as a user inside it, and grant CREATE TABLE plus the row rights there. The narrower grant is easier to audit and cannot touch any other database on the instance.

Should the connection use Windows Authentication instead of SQL Authentication?

Either works, and the required rights are the same. With Windows Authentication the rights usually arrive through group memberships, and SQL Server builds the login's token at sign-in, so a group change needs a new session to take effect. With SQL Authentication the grants sit on the login itself and apply to the next statement. Keep the account dedicated to this connection either way.

What does Ignition store in the tables it creates?

Usernames, role memberships and password hashes; the manual documents that Automatic Mode stores the password as a SHA1 hash, so the tables never hold a readable password. Read access to those tables is still sensitive, because anyone who can SELECT the user table holds the hashes. That is one more reason to keep the grant narrow and the login dedicated.

Keep reading

  • Troubleshooting

    Fix Ignition SQL Server connection faults after an upgrade

    After an Ignition 8.1.x upgrade, a faulted SQL Server connection is almost never a credentials problem: the new Java runtime disables TLS 1.0 and 1.1 (builds from 8u291), and a Microsoft JDBC driver as old as 4.0 cannot run on it. Read the Gateway exception, then patch SQL Server to TLS 1.2 per KB3135244 or replace the driver; the reported working pair was 9.4 in place of 4.0.

    Edge computing and IIoT

  • How-to

    How to log Ignition tags every 15 minutes to a database

    To capture Ignition tag values on a strict 15-minute schedule, use a scheduled SQL Bridge transaction group that inserts a snapshot row into a database table, then point the report's query at that table. The tag historian is deadband-driven and stores asynchronously, so it cannot be set to one fixed 15-minute timestamp.

    Edge computing and IIoT

  • Troubleshooting

    Fix historian table creation failing on MySQL over ODBC

    Capture the MySQL error from the historian's table-creation attempt. Use the historian's runtime connection settings to check the database, account, grants and supported schema. After provisioning for the exact historian release, verify a known test value and its recorded timestamp.

    Edge computing and IIoT