# Cannot connet to some tables in the SQL server database

**URL:** <https://forum.inductiveautomation.com/t/cannot-connet-to-some-tables-in-the-sql-server-database/87179>\
**Category:** Ignition\
**Created:** [March 12, 2024, 12:51pm UTC](https://forum.inductiveautomation.com/t/cannot-connet-to-some-tables-in-the-sql-server-database/87179 "2024-03-12T12:51:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eyad\_Elnagdy](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@Eyad\_Elnagdy](https://forum.inductiveautomation.com/u/Eyad_Elnagdy)\
**Post date:** [March 12, 2024, 12:51pm UTC](https://forum.inductiveautomation.com/t/cannot-connet-to-some-tables-in-the-sql-server-database/87179/1 "2024-03-12T12:51:45Z")

</div>

Hello everyone,

I am trying to add some queries to my Ignition app that gets the data from SQL server database.  
I have configured the connection correctly and I also tried the query I need in the SQL server management studio and they work fine, but when I try them in Ignition it gives me this error. can you please help ?. Thanks

```auto
GatewayException: Unknown SQL type: -155
	caused by SQLException: Unknown SQL type: -155

Ignition v8.1.31 (b2023081007)
Java: Azul Systems, Inc. 11.0.18

com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Unknown SQL type: -155
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:360)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:334)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:287)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.runLimitQuery(GatewayInterface.java:893)
	at com.inductiveautomation.ignition.designer.querybrowser.QueryBrowser.lambda$runQuery$4(QueryBrowser.java:488)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Unknown SQL type: -155
	at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.RunQuery.run(RunQuery.java:119)
	at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.AbstractDBAction.invoke(AbstractDBAction.java:66)
	at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:435)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:523)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
	at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:86)
	at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1410)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
	at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
	at com.inductiveautomation.catapult.handlers.RemoteHostNameLookupHandler.handle(RemoteHostNameLookupHandler.java:121)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:301)
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
	at org.eclipse.jetty.server.Server.handle(Server.java:563)
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
	at java.lang.Thread.run(null)

Ignition v8.1.31 (b2023081007)
Java: Azul Systems, Inc. 11.0.18

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 12, 2024, 1:11pm UTC](https://forum.inductiveautomation.com/t/cannot-connet-to-some-tables-in-the-sql-server-database/87179/2 "2024-03-12T13:11:07Z")

</div>

You're table has a `DATETIMEOFFSET` column type, which the JDBC driver doesn't handle because "Microsoft".

At the very least use a `datetime2` type instead.

---

<div class="post-metadata">

**Author:** ![Eyad\_Elnagdy](https://avatars.discourse-cdn.com/v4/letter/e/96bed5/32.png) [@Eyad\_Elnagdy](https://forum.inductiveautomation.com/u/Eyad_Elnagdy)\
**Post date:** [March 12, 2024, 3:06pm UTC](https://forum.inductiveautomation.com/t/cannot-connet-to-some-tables-in-the-sql-server-database/87179/3 "2024-03-12T15:06:42Z")

</div>

Thanks a lot. I converted the datatype in the query to datetime2 and it works now.

---

<div class="post-metadata">

**Author:** ![Michael\_Palmer](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Michael\_Palmer](https://forum.inductiveautomation.com/u/Michael_Palmer)\
**Post date:** [January 7, 2025, 10:09pm UTC](https://forum.inductiveautomation.com/t/cannot-connet-to-some-tables-in-the-sql-server-database/87179/4 "2025-01-07T22:09:43Z")

</div>

Is there any other work around. I'm not able to get the DB changed as the developers who are writing to this DB want to use DATETIMEOFFSET. Is there really no way for me to read these values from the DB? (unless they change it to datetime2?)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [January 7, 2025, 10:25pm UTC](https://forum.inductiveautomation.com/t/cannot-connet-to-some-tables-in-the-sql-server-database/87179/5 "2025-01-07T22:25:32Z")

</div>

> [@Michael\_Palmer](#):
>
> Is there really no way for me to read these values from the DB?

As far as I know.

You might try seeing if there is a newer version of the JDBC driver that would accept it, I wouldn't hold my breath. Microsoft likes to be "special"

---

<div class="post-metadata">

**Author:** ![Michael\_Palmer](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@Michael\_Palmer](https://forum.inductiveautomation.com/u/Michael_Palmer)\
**Post date:** [October 6, 2025, 5:52pm UTC](https://forum.inductiveautomation.com/t/cannot-connet-to-some-tables-in-the-sql-server-database/87179/6 "2025-10-06T17:52:41Z")

</div>

I finally found a solution.

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

I had to Cast as DATETIME2, and now the query works
