# Urgent: Critical Issue - Unable to Insert Data into MSSQL Database During Script Execution

**URL:** <https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615>\
**Category:** Ignition\
**Tags:** python, database, scripting, ignition81\
**Created:** [June 10, 2024, 12:17pm UTC](https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615 "2024-06-10T12:17:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ramya\_R](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@Ramya\_R](https://forum.inductiveautomation.com/u/Ramya_R)\
**Post date:** [June 10, 2024, 12:17pm UTC](https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615/1 "2024-06-10T12:17:12Z")

</div>

Hello Everyone ,

I hope this email finds you well.

I am writing to report an urgent issue that we have encountered in our Ignition application(8.1.35), which is severely impacting our production applications.

Problem Description: While running a script in our Ignition application, we are encountering difficulties in inserting values into our MSSQL database. The following error message is observed:

([default]Tags/OEE/Enterprise/BG4/Plant1/Line1/Machine1/OEE/OEE\_Trigger, valueChanged) Error executing tag event script:  
Traceback (most recent call last):  
File "tagevent:valueChanged", line 58, in valueChanged  
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:392)  
at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.runPrepUpdate(AbstractDBUtilities.java:268)  
at jdk.internal.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)  
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
at java.base/java.lang.reflect.Method.invoke(Unknown Source)  
java.lang.Exception: java.lang.Exception: Error executing system.db.runPrepUpdate(INSERT INTO OEE\_Data (En, Bg, Plant, Line, Machine, Sam\_Start\_Time, Sam\_end\_Time, StopTime, run\_time, Off\_time, Handling\_time, Maching\_Time, Partid, total\_Count, Rejection, Good\_Count, Operating\_Time, Operator, idle\_Cycle\_time, CTE, CTH, CTL, Shift, Hour, downTime, Recess, Datetime\_Hour, Shifttime, Shift\_Hour) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?), [1, 4, 1, 1, 1, 2024-06-07 15:02:46.873, 2024-06-07 16:03:41.51, 0, 3334, 0, 150, 1186, 2, 4, 0, 4, 5379, 2, 1681, 0, 0, 4, Shift2, 16-17, 2045, 0, 2024-06-07 16:00:00, 510, 2024-06-07 15:00:00.000], DBA1, , false, false)

This error occurs frequently and affects the functionality of our application. It appears to be related to a database update/insert operation in our `OEE_Data` table.

Steps Taken: We have attempted to troubleshoot the issue internally but have been unable to identify a root cause or implement a resolution. We have verified that the database connection is active and that there are no apparent network or configuration issues. Additionally, we have observed that both CPU and database (DB) usage on our system are consistently at 100%, indicating that our resources are heavily overloaded. As a result, we are encountering difficulties in inserting queries into our MSSQL database.

Request for Urgent Assistance: Given the critical nature of this issue and its impact on our operations, we urgently require your assistance in investigating and resolving this matter. We kindly request your immediate attention to this issue and any guidance or support you can provide to help us resolve it as quickly as possible.

Additional Information:

Ignition Version: 8.1.35  
MSSQL Database Version: Microsoft SQL Server 2019  
Database Connection Details: Database Connection name is DBA1

I have attached Gateway logs for your reference. Please let us know if you require any further information or assistance from our end. We are available to provide additional details or collaborate with your team to address this issue urgently.

PFA mail id : [ar.ramya@ranegroup.com](mailto:ar.ramya@ranegroup.com)

Thank you for your prompt attention to this matter.

 ![Ignition_slow query_Screenshot](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/3/33e3b24b90afafcd2fa26e2ff02d7b6a7e1ff218.png)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 11, 2024, 1:24pm UTC](https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615/2 "2024-06-11T13:24:04Z")

</div>

Be warned that the forums are not support. If it is truly urgent you can contact them here:  
[https://support.inductiveautomation.com/](https://support.inductiveautomation.com/)

> [@Ramya\_R](#):
>
> Additionally, we have observed that both CPU and database (DB) usage on our system are consistently at 100%

That said, you have not given any information on your Ignition / DB setup, how often you're trying to write to the DB, etc.  
If it's related to this post:

> [@Ignition - High CPU Usage in MS SQL DB](https://forum.inductiveautomation.com/t/ignition-high-cpu-usage-in-ms-sql-db/79630):
>
> We are using Ignition 8.1.23 version. I have a serious problem with my ignition instance and that their SQL server was hanging on 100%. The Ignition gateway and the database server are in different AWS instances. CPU Suddenly, the CPU usage increments and everything in my server falls down, Data logging stopped in DB like that. Then I have restarted the Gateway/ AWS instances and the CPU usage decrements again and I still cannot find why. This has happened multiple times in the last 2 weeks. …

You didn't give any information there, either.

If you expand the error in the log, there should be a 'Caused by' section. Post the entire error here

My gut tells me your AWS instances are underprovisioned for what you are trying to do.

---

<div class="post-metadata">

**Author:** ![Ramya\_R](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@Ramya\_R](https://forum.inductiveautomation.com/u/Ramya_R)\
**Post date:** [June 12, 2024, 10:15am UTC](https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615/3 "2024-06-12T10:15:57Z")

</div>

Hi Jordan,  
our infrastructure setup for the Ignition system.

1. Application Server Instance: We have dedicated one AWS instance specifically for hosting the Ignition application. This instance is where the Ignition software is installed and runs.
2. Database Server Instance: Installed separately on another AWS instance.

By maintaining separate servers for the application and the database, we aim to enhance performance, scalability, and maintainability.

In addition to segregating our resources, we've implemented various configurations to ensure secure and efficient communication between the application and database servers. This includes setting up tunnel connections and firewall configurations.

If you have any questions or require further details about our infrastructure setup, please feel free to reach out.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [June 12, 2024, 10:41am UTC](https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615/4 "2024-06-12T10:41:47Z")

</div>

Becaue I sometomes say valuable things. 😉

> [@JordanCClark](#):
>
> If you expand the error in the log, there should be a 'Caused by' section. Post the entire error here
> 
> My gut tells me your AWS instances are underprovisioned for what you are trying to do.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 12, 2024, 10:51am UTC](https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615/5 "2024-06-12T10:51:46Z")

</div>

> [@Ramya\_R](#):
>
> If you have any questions or require further details about our infrastructure setup, please feel free to reach out.

That's not really how forums with volunteers work. Provide as much detail as practical up front, preferably in text form (not only screenshots). If you need someone to work with you "live", contact IA support. They can do that.

---

<div class="post-metadata">

**Author:** ![Ramya\_R](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@Ramya\_R](https://forum.inductiveautomation.com/u/Ramya_R)\
**Post date:** [June 12, 2024, 11:32am UTC](https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615/6 "2024-06-12T11:32:39Z")

</div>

Hi pturmel, I have raised a ticket to inductive automation.

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [June 12, 2024, 12:20pm UTC](https://forum.inductiveautomation.com/t/urgent-critical-issue-unable-to-insert-data-into-mssql-database-during-script-execution/91615/7 "2024-06-12T12:20:58Z")

</div>

> [@Ramya\_R](#):
>
> Additionally, we have observed that both CPU and database (DB) usage on our system are consistently at 100%, indicating that our resources are heavily overloaded

It looks like you have a number of tag event scripts triggering scripts with database queries and you're running out of system resources. I agree with @JordanCClark. You probably need more resources on your server. It's possible you could be triggering expensive events to happen more often than you intend.

If you're running your Ignition gateway with 100% in any critical resource it can cause unexpected results in Ignition. I've seen this happen on servers that have insufficient resources to do what they are trying to do.
