I’m currently having an issue getting an issue with SQL historian not creating tables in MSSQL database. After creating the database connection and adding the historian, the following error is shown in the logs.
ERROR
TagHistoryDatasourceSink
05Feb2026 14:08:58
Data sink 'ignition_sql' has encountered critical failure.
java.lang.IllegalStateException: Initialization of tag history datasource sink has failed!
at com.inductiveautomation.sqlhistorian.gateway.storage.TagHistoryDatasourceSink.onInitialize(TagHistoryDatasourceSink.java:241)
at com.inductiveautomation.ignition.gateway.storeforward.sinks.AbstractSink.initialize(AbstractSink.java:138)
at com.inductiveautomation.ignition.gateway.storeforward.sinks.AbstractDatasourceSink$DatasourceConnectionListener.onStatusChanged(AbstractDatasourceSink.java:281)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.lambda$notifyListeners$3(DatasourceImpl.java:614)
at java.base/java.util.ArrayList.forEach(Unknown Source)
at java.base/java.util.Collections$SynchronizedCollection.forEach(Unknown Source)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.notifyListeners(DatasourceImpl.java:614)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.setStatus(DatasourceImpl.java:508)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.runTest(DatasourceImpl.java:333)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceManagerImpl$FaultedDatasourceRetryer.lambda$newRetryRunnable$0(DatasourceManagerImpl.java:1174)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$TrackedTask.run(BasicExecutionEngine.java:593)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Exception: Error running query: CREATE TABLE sqlth_drv (id int NOT NULL AUTO_INCREMENT,name varchar(255),provider varchar(255),PRIMARY KEY (id))
at com.inductiveautomation.ignition.gateway.db.schema.DBTableSchema.executeCommandSet(DBTableSchema.java:139)
at com.inductiveautomation.ignition.gateway.db.schema.DBTableSchema.createTable(DBTableSchema.java:108)
at com.inductiveautomation.ignition.gateway.db.schema.DBTableSchema.verifyAndUpdate(DBTableSchema.java:91)
at com.inductiveautomation.sqlhistorian.gateway.storage.TagHistoryDatasourceSink.checkTables(TagHistoryDatasourceSink.java:1657)
at com.inductiveautomation.sqlhistorian.gateway.storage.TagHistoryDatasourceSink.onInitialize(TagHistoryDatasourceSink.java:230)
... 16 common frames omitted
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near 'AUTO_INCREMENT'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:278)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1788)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:975)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:869)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7825)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:4828)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:321)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:253)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeUpdate(SQLServerStatement.java:808)
at org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:331)
at org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:331)
at com.inductiveautomation.ignition.gateway.datasource.DelegatingStatement.executeUpdate(DelegatingStatement.java:80)
at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRStatement.executeUpdate(SRConnectionWrapper.java:867)
at com.inductiveautomation.ignition.gateway.db.schema.DBTableSchema.executeCommandSet(DBTableSchema.java:137)
... 20 common frames omitted
Based on this line from the error message…
Caused by: java.lang.Exception: Error running query: CREATE TABLE sqlth_drv (id int NOT NULL AUTO_INCREMENT,name varchar(255),provider varchar(255),PRIMARY KEY (id))
I’m lead to believe the MSSQL driver is not using the MSSQL translator. When I navigate to Connections>Databases>Settings, the “Default Translator” is listed as MSSQL, but the command AUTO_INCREMENT that is causing the syntax error is not used in the MSSQL translator, only the other translators.
Most recently, I tried the following to correct this issue thinking it would be as close as I could get to a clean install of MSSQL drivers without reinstalling Ignition entirely...
- Delete historian and database from gateway
- Restart gateway
- Disable MSSQL module
- Restart gateway
- Delete MSSQL module
- Restart gateway
- Install MSSQL module
- Restart gateway
and the issue still persist. I've restored this gateway backup from a production environment to a local gateway for troubleshooting, so I have the flexibility to try most troubleshooting options. Gateway version is 8.3.2 but I have also tried to solve this on 8.3.3 as well with no luck. Any suggestions are greatly appreciated!