# Ignition 8.1.0 - default Error executing annotation query with powerChart component

**URL:** <https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [November 10, 2020, 4:36pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494 "2020-11-10T16:36:39Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [November 10, 2020, 4:36pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/1 "2020-11-10T16:36:40Z")

</div>

**Ignition 8.1.0**  
MYSQL 8.0.20  
JDBC Driver: mysql-connector-java-8.0.20.jar

When I use the **perspective powerChart** component, every seconds I have the following error in the gateway logs.

```auto
DB	10Nov2020 17:30:16	default Error executing annotation query.

```

```auto
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)

at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)

at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)

at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953)

at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1003)

at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)

at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:122)

at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRPreparedStatement.executeQuery(SRConnectionWrapper.java:1008)

at com.inductiveautomation.gateway.tags.history.query.DatasourceAnnotationQuery.execute(DatasourceAnnotationQuery.java:119)

at com.inductiveautomation.gateway.tags.history.module.TagHistoryProvider.queryAnnotations(TagHistoryProvider.java:275)

at com.inductiveautomation.ignition.gateway.sqltags.history.TagHistoryManagerImpl.queryAnnotations(TagHistoryManagerImpl.java:665)

at com.inductiveautomation.ignition.gateway.tags.model.ProjectDefaultTagManagerFacade.queryAnnotations(ProjectDefaultTagManagerFacade.java:441)

at com.inductiveautomation.perspective.gateway.components.PowerChartModelDelegate$AnnotationFetch.fetch(PowerChartModelDelegate.java:229)

at com.inductiveautomation.perspective.gateway.comm.FetchableCacheImpl.fetch(FetchableCacheImpl.java:31)

at com.inductiveautomation.perspective.gateway.comm.Routes.handleFetch(Routes.java:1510)

at com.inductiveautomation.ignition.gateway.dataroutes.Route.service(Route.java:252)

at com.inductiveautomation.ignition.gateway.dataroutes.RouteGroupImpl.service(RouteGroupImpl.java:61)

at com.inductiveautomation.ignition.gateway.dataroutes.RouteGroupCollectionServlet.serviceInternal(RouteGroupCollectionServlet.java:54)

at com.inductiveautomation.ignition.gateway.dataroutes.AbstractRouteGroupServlet.service(AbstractRouteGroupServlet.java:38)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1391)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:760)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:547)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)

at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)

at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

at org.eclipse.jetty.server.Server.handle(Server.java:500)

at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)

at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)

at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)

at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)

at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388)

at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)

at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)

at java.base/java.lang.Thread.run(Unknown Source)

```

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c210bfafb4c4738f23f2157a110c6cb7843bc2aa.png)

Ticket  
#134078

---

<div class="post-metadata">

**Author:** ![matt.eaton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matt.eaton/32/72046_2.png) [@matt.eaton](https://forum.inductiveautomation.com/u/matt.eaton)\
**Post date:** [January 8, 2021, 5:18pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/2 "2021-01-08T17:18:16Z")

</div>

I have the same issue but only when using the power chart with a filter path, if I remove the filter path there’s no error. (troubleshooting only, that won’t be an acceptable solution)

---

<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:** [January 8, 2021, 6:16pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/3 "2021-01-08T18:16:34Z")

</div>

Is that the full text of the error message? Can you try setting the `gateway.database.selects` logger to TRACE (briefly, it’ll throw a _lot_ of messages into the logs) and capturing a log export to upload or send in to support.

---

<div class="post-metadata">

**Author:** ![matt.eaton](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matt.eaton/32/72046_2.png) [@matt.eaton](https://forum.inductiveautomation.com/u/matt.eaton)\
**Post date:** [January 8, 2021, 6:38pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/4 "2021-01-08T18:38:08Z")

</div>

Yes, that’s the full text.  
Yes I can put it into trace and see what we get.  
I am not sure if I can get the logs out of the client machine, but I’ll ask if we’ve got a reasonable method to get files out and see what I can do.  
Is there a ticket or attention line you want me to mention on submission? I don’t have a ticket started on the subject, just this forum stuff.

---

<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:** [January 8, 2021, 10:15pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/5 "2021-01-08T22:15:44Z")

</div>

Ideally get in contact with support with the logs - you can mention this forum thread and they’ll chase me down.

---

<div class="post-metadata">

**Author:** ![isabellapitco](https://avatars.discourse-cdn.com/v4/letter/i/ebca7d/32.png) [@isabellapitco](https://forum.inductiveautomation.com/u/isabellapitco)\
**Post date:** [April 26, 2021, 9:12pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/6 "2021-04-26T21:12:41Z")

</div>

I’m having the same issue, was this ever resolved?

---

<div class="post-metadata">

**Author:** ![c-w-t](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@c-w-t](https://forum.inductiveautomation.com/u/c-w-t)\
**Post date:** [April 27, 2021, 4:11pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/7 "2021-04-27T16:11:32Z")

</div>

We have similar errors being logged, we have a 8.1.4 Perspective licensed server that doesn’t have the Tag History module licensed, but it’s connected to a 7.9.17 gateway that does, and I suspect this is an issue with the front end 8.1.4 server not being able to perform annotation queries against the DB that another gateway’s historian is linked to (either intentionally or not).

---

<div class="post-metadata">

**Author:** ![justin.casleton](https://avatars.discourse-cdn.com/v4/letter/j/c5a1d2/32.png) [@justin.casleton](https://forum.inductiveautomation.com/u/justin.casleton)\
**Post date:** [May 5, 2021, 3:02pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/8 "2021-05-05T15:02:27Z")

</div>

Same issue anyone find a solution?

---

<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:** [May 10, 2021, 11:34pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/9 "2021-05-10T23:34:31Z")

</div>

Are all you reporting issues querying data from older (pre 8.1) historians?  
If so, then this is probably an easy enough fix on our end, to just check the version of the target historian. If _not_, then there might be multiple fundamental issues here, so we’ll need more data - which brings me back to “please contact support”.

---

<div class="post-metadata">

**Author:** ![weertske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weertske/32/3353_2.png) [@weertske](https://forum.inductiveautomation.com/u/weertske)\
**Post date:** [May 11, 2021, 5:05pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/10 "2021-05-11T17:05:19Z")

</div>

Paul, At first I thought that checking version would work. It will certainly get rid of the error filling my log. However, if we try to use any portion of the Power Chart that leverages annotations we are still going to break. I believe the only solution no matter how ugly it is, is to add that table to all our historians.

Care to share a MySQL Create statement (not sure about data types).

---

<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:** [May 11, 2021, 5:22pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/11 "2021-05-11T17:22:26Z")

</div>

Something like this should work:

```sql
CREATE TABLE `sqlth_annotations` (
	`id` INT NOT NULL AUTO_INCREMENT,
	`annotationid` VARCHAR,
	`tagid` INT,
	`start_time` BIGINT,
	`end_time` BIGINT,
	`type` VARCHAR,
	`datavalue` VARCHAR,
	PRIMARY KEY (`id`)
);

```

---

<div class="post-metadata">

**Author:** ![weertske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weertske/32/3353_2.png) [@weertske](https://forum.inductiveautomation.com/u/weertske)\
**Post date:** [May 11, 2021, 5:31pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/12 "2021-05-11T17:31:24Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![weertske](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/weertske/32/3353_2.png) [@weertske](https://forum.inductiveautomation.com/u/weertske)\
**Post date:** [May 11, 2021, 5:46pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/13 "2021-05-11T17:46:28Z")

</div>

@paul-griffith I have a couple issues regarding the “Create” statement. According to the SDK it should be “datavalue” not “data\_value”. Which is correct?

Also since this field will carry the actual annotations, should it be a TEXT type to allow for very large entries?

---

<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:** [May 11, 2021, 5:50pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/14 "2021-05-11T17:50:52Z")

</div>

`datavalue` is correct; that was just a mistake on my part translating from Java code to actual SQL syntax. `TEXT` might be more suitable, but our actual internal translator will just create a VARCHAR column.

---

<div class="post-metadata">

**Author:** ![c-w-t](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@c-w-t](https://forum.inductiveautomation.com/u/c-w-t)\
**Post date:** [June 11, 2021, 3:09pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/15 "2021-06-11T15:09:35Z")

</div>

Just to clarify, is it meant to be possible for a 8.1.x server (without tag history license) to execute annotation queries against a remote tag history provider? And if so, should it work when that remote gateway is running 7.9.17? This is what our setup would require. Thanks!

---

<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:** [June 11, 2021, 3:31pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/16 "2021-06-11T15:31:28Z")

</div>

No, you can’t issue any kind of historian query without a tag history license (as of 8.1, where we tightened up some restrictions, iirc).  
The remote gateway running 7.9.17 will not have the ability to query or store new annotations - the manual table creation described here is just to suppress an error until we change things first-party.

---

<div class="post-metadata">

**Author:** ![c-w-t](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@c-w-t](https://forum.inductiveautomation.com/u/c-w-t)\
**Post date:** [June 11, 2021, 4:32pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/17 "2021-06-11T16:32:23Z")

</div>

Ok thanks for the clarification.

---

<div class="post-metadata">

**Author:** ![son122](https://avatars.discourse-cdn.com/v4/letter/s/3be4f8/32.png) [@son122](https://forum.inductiveautomation.com/u/son122)\
**Post date:** [February 3, 2022, 6:31pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/18 "2022-02-03T18:31:33Z")

</div>

@paul-griffith Does it matter whether the datatype is VARCHAR or NVARCHAR?  
This is what our annotation table looks like and we’re getting heavily hit with that message every few second.

```auto
CREATE TABLE [dbo].[sqlth_annotations](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[tagid] [int] NULL,
	[start_time] [bigint] NULL,
	[end_time] [bigint] NULL,
	[type] [nvarchar](255) NULL,
	[datavalue] [nvarchar](255) NULL,
	[annotationid] [nvarchar](255) NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

```

---

<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:** [February 3, 2022, 11:04pm UTC](https://forum.inductiveautomation.com/t/ignition-8-1-0-default-error-executing-annotation-query-with-powerchart-component/40494/19 "2022-02-03T23:04:49Z")

</div>

It shouldn’t matter, but if you upgrade the 8.X gateway originating queries past 8.1.10 this won’t happen anymore. I’d recommend that instead.
