# Error database connection

**URL:** <https://forum.inductiveautomation.com/t/error-database-connection/82085>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 18, 2023, 9:48am UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085 "2023-11-18T09:48:41Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 18, 2023, 9:48am UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/1 "2023-11-18T09:48:41Z")

</div>

Goodmornig,  
sometimes there is connection error to a Sql server database in my Ignition project v 8.1.16.

 ![prova](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/c/3c2a038785997fed645da0c1b619c487c6088898.jpeg)

What could the reason be???

THank you

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 18, 2023, 10:30am UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/2 "2023-11-18T10:30:31Z")

</div>

Please post all the text of the error message and format it with the \</\> button.

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 18, 2023, 11:40am UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/3 "2023-11-18T11:40:04Z")

</div>

```auto
java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object
at org.apache.commons.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:142)
at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:734)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.getConnectionInternal(DatasourceImpl.java:299)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceManagerImpl.getConnectionImpl(DatasourceManagerImpl.java:169)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.getConnection(DatasourceImpl.java:292)
at com.inductiveautomation.ignition.gateway.datasource.DatasourceManagerImpl.getConnection(DatasourceManagerImpl.java:152)
at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities.getConnection(GatewayDBUtilities.java:100)
at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.AbstractDBAction.invoke(AbstractDBAction.java:50)
at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:431)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:86)
at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
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:1624)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at com.inductiveautomation.catapult.handlers.RemoteHostNameLookupHandler.handle(RemoteHostNameLookupHandler.java:121)
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:516)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.util.NoSuchElementException: Timeout waiting for idle object
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:321)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:428)
at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:232)
at org.apache.commons.dbcp2.PoolingDataSource.getConnection(PoolingDataSource.java:134)
... 51 common frames omitted

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 18, 2023, 11:54am UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/4 "2023-11-18T11:54:56Z")

</div>

1. Is the server on the same computer as the Ignition gateway?
2. If not, is it on the same subnet as the gateway or is it remote?
3. Is it Microsoft SQL Server?
4. What other information do you have that might help?

---

<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:** [November 18, 2023, 1:40pm UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/5 "2023-11-18T13:40:50Z")

</div>

Right at the top:

```auto
Cannot get a connection, pool error Timeout waiting for idle object

```

This isn't an error on the database side, strictly speaking. Ignition makes multiple internal connections to your DB and recycles them as each query completes. The number and behavior of this "connection pool" is part of the advance settings on a database connection.

Not getting a connection for this timeout means you are running more **simultaneous long queries** than your DB can handle. Either your queries are not properly optimized, or your DB is simply not powerful enough to keep up.

This error doesn't give enough information to tell which of those cases apply.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 18, 2023, 1:43pm UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/6 "2023-11-18T13:43:17Z")

</div>

> [@pturmel](#):
>
> `pool error`

That's interesting, Phil. The "pool" is some maximum number of available connections internal to the database? And each query takes one from the pool until completed or timed out?

---

<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:** [November 18, 2023, 1:44pm UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/7 "2023-11-18T13:44:18Z")

</div>

Not internal to the database, but internal to Ignition, based on the data source connection settings.

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 18, 2023, 3:55pm UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/8 "2023-11-18T15:55:20Z")

</div>

Sql Server is on the same computer of Ignition Gatewway

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [November 18, 2023, 4:04pm UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/9 "2023-11-18T16:04:31Z")

</div>

-Have you upgraded the gateway recently?  
-did you try to connect directly to the database through ssms "microsoft sql server management studio"?

---

<div class="post-metadata">

**Author:** ![stefano.sforna](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@stefano.sforna](https://forum.inductiveautomation.com/u/stefano.sforna)\
**Post date:** [November 19, 2023, 9:35am UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/10 "2023-11-19T09:35:26Z")

</div>

No, I don't upgraded gateway recently.  
When there is error of database connection, it is not possible connect with "microsoft sql server management studio"

---

<div class="post-metadata">

**Author:** ![samer\_samy](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/samer_samy/32/52910_2.png) [@samer\_samy](https://forum.inductiveautomation.com/u/samer_samy)\
**Post date:** [November 19, 2023, 10:56am UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/11 "2023-11-19T10:56:17Z")

</div>

If you cannot connect through SSMS ,so it is not the problem of ignition ,If you can connect through SSMS but can not connect through ignition ,here you have a problem in ignition.

---

<div class="post-metadata">

**Author:** ![Gulshan\_Negi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gulshan_negi/32/53208_2.png) [@Gulshan\_Negi](https://forum.inductiveautomation.com/u/Gulshan_Negi)\
**Post date:** [November 20, 2023, 1:41pm UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/12 "2023-11-20T13:41:22Z")

</div>

Well, this can happen due to connection issues means there are many chances of connection leaks for this you can increase the connection pool size there is a strong chance of fixing these issues.  
Thanks

---

<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:** [November 20, 2023, 2:25pm UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/13 "2023-11-20T14:25:31Z")

</div>

> [@Gulshan\_Negi](#):
>
> many chances of connection leaks

??

This I have not ever seen. In every case I've seen (many), the number of queries trying to run times the average execution time was greater than the timeout for acquiring a connection.

> [@Gulshan\_Negi](#):
>
> increase the connection pool size

Maybe. If the number of queries that are running too long are strictly limited, this can help. But if the DB is overloaded (as I suspect), then more connections won't make the database go faster--the extra connections will simply bog down, too.

> [@Gulshan\_Negi](#):
>
> Well, ....

This forum has many international participants whose first language is not English. Proper sentence structure, capitalization, and punctuation are not only signs of professionalism, but are crucial for understanding among the non-native-english-speakers here. Please correct your comment accordingly.

---

<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:** [November 20, 2023, 2:27pm UTC](https://forum.inductiveautomation.com/t/error-database-connection/82085/14 "2023-11-20T14:27:15Z")

</div>

> [@stefano.sforna](#):
>
> on the same computer

This is terribly unwise, especially for a production system.
