# Failed to write data into SQL

**URL:** <https://forum.inductiveautomation.com/t/failed-to-write-data-into-sql/44296>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [March 10, 2021, 8:35am UTC](https://forum.inductiveautomation.com/t/failed-to-write-data-into-sql/44296 "2021-03-10T08:35:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kartik.i](https://avatars.discourse-cdn.com/v4/letter/k/e9c0ed/32.png) [@kartik.i](https://forum.inductiveautomation.com/u/kartik.i)\
**Post date:** [March 10, 2021, 8:35am UTC](https://forum.inductiveautomation.com/t/failed-to-write-data-into-sql/44296/1 "2021-03-10T08:35:02Z")

</div>

Hello,

```
I have an observation today that the Ignition was unable to write the data into the database table I have attached below a wrapper log for this issue could anyone tell why this happened.

```

E [c.i.i.g.a.DatasourceAuditProfile] [05:30:29]: Error auditing [DefaultAuditRecord[action=“tag write”, actionTarget=“CarMapTemplate”, actionValue=“Dataset [413R ? 11C]”, actor=“admin”, actorHost=“SCADAServer”, context=“4”, system=“project=Direxa\_United”, status=“AuditStatus[0x00000000, Severity=Good, Subcode=NotSpecified]”, timestamp=“Mon Mar 08 23:30:29 CST 2021”]], due to underlying exception.  
INFO | jvm 2 | 2021/03/08 23:30:29 | com.microsoft.sqlserver.jdbc.SQLServerException: The INSERT statement conflicted with the CHECK constraint “CHECK\_ACTION”. The conflict occurred in database “SupervisionDB”, table “dbo.AUDIT\_EVENTS”, column ‘ACTION’.  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1454)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:388)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:306)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRPreparedStatement.executeUpdate(SRConnectionWrapper.java:955)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper.runPrepUpdate(SRConnectionWrapper.java:180)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.inductiveautomation.ignition.gateway.audit.DatasourceAuditProfile.audit(DatasourceAuditProfile.java:188)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.SQLTags.audit(SQLTags.java:759)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.SQLTags$ClientWriteOperation.run(SQLTags.java:694)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at java.util.concurrent.FutureTask.run(Unknown Source)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
INFO | jvm 2 | 2021/03/08 23:30:29 | at java.lang.Thread.run(Unknown Source)

Thanks,  
Kartik I

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 10, 2021, 3:59pm UTC](https://forum.inductiveautomation.com/t/failed-to-write-data-into-sql/44296/2 "2021-03-10T15:59:54Z")

</div>

> [@kartik.i](#):
>
> INFO | jvm 2 | 2021/03/08 23:30:29 | com.microsoft.sqlserver.jdbc.SQLServerException: The INSERT statement conflicted with the CHECK constraint “CHECK\_ACTION”. The conflict occurred in database “SupervisionDB”, table “dbo.AUDIT\_EVENTS”, column ‘ACTION’.

SQL Server told Ignition (via the JDBC driver) that the insert wasn't allowed. You need to figure out why, in SQL Server.

---

<div class="post-metadata">

**Author:** ![kartik.i](https://avatars.discourse-cdn.com/v4/letter/k/e9c0ed/32.png) [@kartik.i](https://forum.inductiveautomation.com/u/kartik.i)\
**Post date:** [March 11, 2021, 10:15am UTC](https://forum.inductiveautomation.com/t/failed-to-write-data-into-sql/44296/3 "2021-03-11T10:15:49Z")

</div>

Thanks I will look on it.
