MySQL Database Locked

I have seen reference to this issue with a remote SQL database but this is a simple local MySQL set up.
Client contacted me that he was seeing a “Red Screen” when accessing a historical “Power Chart”

When I Iooked at the Gateway the error logs shows:

java.lang.Exception: Error running query:
TagHistory(paths=[histprov:default:/prov:default:/tag:Aseptic Barriers/UB-6/TT2, histprov:default:/prov:default:/tag:Aseptic Barriers/UB-6/TT3, histprov:default:/prov:default:/tag:Aseptic Barriers/UB-6/TT4, histprov:default:/prov:default:/tag:Aseptic Barriers/UB-6/TT5], start=Sat Sep 03 07:02:30 CDT 2022, end=Sat Sep 03 19:02:30 CDT 2022, flags=0)@5000ms
On: UltrBarriers UB6.Root Container.Easy Chart
at com.inductiveautomation.factorypmi.application.gateway.QueryManager$
at java.base/ Source)
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: [SQLITE_BUSY] The database file is locked (database is locked)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runTagHistoryQuery(
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runTagHistoryQuery(
at com.inductiveautomation.factorypmi.application.gateway.GwiTagHistoryProvider.query(
at com.inductiveautomation.ignition.common.sqltags.history.cache.StandardCacheBucket.loadData(
at com.inductiveautomation.ignition.common.sqltags.history.cache.StandardCacheBucket.getData(
at com.inductiveautomation.ignition.common.sqltags.history.cache.SubCache$BucketHit.getData(
at com.inductiveautomation.ignition.common.sqltags.history.cache.SubCache.getData(
at com.inductiveautomation.ignition.common.sqltags.history.cache.TagHistoryCache.query(
at com.inductiveautomation.factorypmi.application.gateway.TagHistoryQuery.execute(
at com.inductiveautomation.factorypmi.application.gateway.QueryManager$Query.execute(
at com.inductiveautomation.factorypmi.application.gateway.QueryManager$
… 1 more
Caused by: org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)
at org.sqlite.core.DB.newSQLException(
at org.sqlite.core.DB.newSQLException(
at org.sqlite.core.DB.execute(
at org.sqlite.jdbc3.JDBC3PreparedStatement.executeQuery(
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(
at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRPreparedStatement.executeQuery(
at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper.runPrepQuery(
at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper.runPrepLimitQuery(
at com.inductiveautomation.gateway.tags.history.query.DatasourceQueryExecutor.runSpecialValueQuery(
at com.inductiveautomation.gateway.tags.history.query.DatasourceQueryExecutor.readCompletionValues(
at com.inductiveautomation.gateway.tags.history.query.DatasourceQueryExecutor.primeRead(
at com.inductiveautomation.ignition.gateway.sqltags.history.query.AbstractHistoryLoader.startReading(
at com.inductiveautomation.ignition.gateway.sqltags.history.query.AggregateHistoryQueryExecutor.startReading(
at com.inductiveautomation.ignition.gateway.sqltags.history.query.HistoryWriter.readData(
at com.inductiveautomation.ignition.gateway.sqltags.history.query.HistoryWriter.execute(
at com.inductiveautomation.ignition.gateway.sqltags.history.TagHistoryManagerImpl.queryHistory(
at com.inductiveautomation.ignition.gateway.tags.model.ProjectDefaultTagManagerFacade.queryHistory(
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.QueryTagHistory.invoke(
at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(
at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(
at org.eclipse.jetty.servlet.ServletHolder.handle(
at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(
at org.eclipse.jetty.servlet.ServletHandler.doHandle(
at org.eclipse.jetty.server.handler.ScopedHandler.handle(
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(
at org.eclipse.jetty.server.session.SessionHandler.doHandle(
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(
at org.eclipse.jetty.servlet.ServletHandler.doScope(
at org.eclipse.jetty.server.session.SessionHandler.doScope(
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(
at org.eclipse.jetty.server.handler.ContextHandler.doScope(
at org.eclipse.jetty.server.handler.ScopedHandler.handle(
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
at com.inductiveautomation.catapult.handlers.RemoteHostNameLookupHandler.handle(
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(
at org.eclipse.jetty.server.handler.HandlerList.handle(
at org.eclipse.jetty.server.handler.HandlerCollection.handle(
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
at org.eclipse.jetty.server.Server.handle(
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(
at org.eclipse.jetty.server.HttpChannel.dispatch(
at org.eclipse.jetty.server.HttpChannel.handle(
at org.eclipse.jetty.server.HttpConnection.onFillable(
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
at org.eclipse.jetty.util.thread.QueuedThreadPool$

Ignition v8.1.16 (b2022040511)
Java: Azul Systems, Inc.

SQLite is a single-threaded database. It is only suitable for light-duty applications, like configuration data or extremely light history loads.

Use a real database.

Hmmm. This is Ignition’s configuration database that is locked, not your history. Look for log entries about something holding the internal DB open for more than 30 seconds. That will be the real culprit.

Thanks…I’ll see what I can find in there…

There are many of these errors:

MemoryForwardTransaction 07Sep2022 17:31:26 Error forwarding data
org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)

at org.sqlite.core.DB.newSQLException(

at org.sqlite.core.DB.newSQLException(

at org.sqlite.core.DB.throwex(

at org.sqlite.core.DB.exec(

at org.sqlite.jdbc3.JDBC3Connection.commit(

at org.apache.commons.dbcp2.DelegatingConnection.commit(

at org.apache.commons.dbcp2.DelegatingConnection.commit(

at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper.commit(

at com.inductiveautomation.ignition.gateway.history.sf.sinks.AbstractDatasourceSink.storeToDatasource(

at com.inductiveautomation.ignition.gateway.history.sf.sinks.AbstractDatasourceSink.storeData(

at com.inductiveautomation.ignition.gateway.history.sf.sinks.AggregateSink.storeData(

Any hints on finding specific log entries would be a great help… I don’t see any reference to either the “internal Database” or “more than 30 seconds”

The stack traces indicate history storage, but contrary to this post title they also indicate the target DB is SQLite and not MySQL.

@Keith_Magill I suggest that you give support a call and let them get you sorted out.

1 Like


Thanks. I will call in the morning.

Something’s odd.

Ok. Mystery solved.
Issue was due to the configuration of multiple SQLITE databases with the same URLs.
When you create new databases based on SQLITE, the configuration defaults to the same URL each time. This is not allowed with SQLITE. I had to edit the second occurrence to use a different path.
It would be nice if the configuration would automatically concatenate the new database name or automatically index the file name into the URL path so this could not occur…


What are you using SQLite for?

I struck this out above, but it sounds like it is applicable:

Really. ):

1 Like


Well now that statement makes sense. I am not a huge SQL user other than with Ignition. I read “single-threaded” but I just figured it meant “slow”.
Some of us just need to learn the “hard way”.

System is being migrated to a full SQL server system as soon as the equipment “arrives” .

Is there a way to import the SQLITE data into real SQL??

Some of us just need to learn the “hard way”.

Nothing wrong with that, I kind of prefer it as the lesson’s stick much better.

You can transfer from SQLite (and other SQL Databases) to SQL Server provided you get the right driver. Here’s a short walkthrough listing the steps (bottom of the article) How to Migrate SQLite to SQL Server? | Easy Steps - Learn | Hevo

If you don’t have many tables and no live data, it might be easier to just recreate the tables in sql server with new create statements.


What Brian said.

In the future, if you need a free database product that can handle real workloads, install PostgreSQL (my fave) or MariaDB.


Yea it should be noted that SQL Server, in line with Microsofts general philosophy, tries to lock you in.

A simple example is that every sane SQL Database lets you limit a query with
SELECT * FROM someTable LIMIT 10 to limit it to 10 rows with a LIMIT clause at the end.

SQL Server decided to get the same behavior to do SELECT TOP 10 * FROM someTable. You may think they just made a mistake with their syntaxing, but the real reason (imo, I don’t know if this is confirmed or just my tin foil hat) is if you have a working application in SQL Server with all their specific syntax around, now converting it to any other database is a much bigger hassle so you’re more likely to just stick with SQL Server.

PostGres, MariaDB and MySQL do not try to lock you in, at least not in such an obvious and hard to work around manner.

Another option to consider, that I use in my own office, is to install and run MS SQL Server for Linux with the development license selected. No programmatic limits, but do strictly obey the development-only rules. The win is that it can make proper MS DB backups (v2019 at the moment) that can be loaded into the future production system. (And vice versa, which is what I mostly do.)

Microsoft maintains an Ubuntu-compatible repo that makes its installation astonishingly easy, along with a variety of command line tools. Cudos to Microsoft for this. (Gah! It burns!)


Phil, is everything ok?


My tongue is scorched. :crazy_face:


Thanks for all of your help.
I will look into PostgreSQL…

MariaDB is more user friendly, for those starting out, in my opinion


I didn’t think those two things together was actually possible. :laughing:

They also offer container images for SQL Server on Linux, pretty handy as well: