# Cannot create PoolableConnectionFactory (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)

**URL:** <https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [April 1, 2022, 3:14pm UTC](https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935 "2022-04-01T15:14:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leonel\_Rodriguez](https://avatars.discourse-cdn.com/v4/letter/l/a3d4f5/32.png) [@Leonel\_Rodriguez](https://forum.inductiveautomation.com/u/Leonel_Rodriguez)\
**Post date:** [April 1, 2022, 3:14pm UTC](https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935/1 "2022-04-01T15:14:07Z")

</div>

Hello everyone, I have very little experience with DB connections and I am having problems trying to connect to a MySQL DB from a seperate machine.

The error details are:

org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)  
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)  
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)  
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.getConnectionInternal(DatasourceImpl.java:242)  
at com.inductiveautomation.ignition.gateway.datasource.DatasourceImpl.runTest(DatasourceImpl.java:196)  
at com.inductiveautomation.ignition.gateway.datasource.DatasourceManagerImpl$FaultedDatasourceRetryer.lambda$newRetryRunnable$0(DatasourceManagerImpl.java:998)  
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$TrackedTask.run(BasicExecutionEngine.java:565)  
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)  
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)  
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)  
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  
at java.lang.Thread.run(Unknown Source)  
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.  
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)  
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)  
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)  
at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456)  
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)  
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)  
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)  
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)  
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)  
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)  
… 12 more  
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.  
at sun.reflect.GeneratedConstructorAccessor143.newInstance(Unknown Source)  
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)  
at java.lang.reflect.Constructor.newInstance(Unknown Source)  
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)  
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)  
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)  
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)  
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)  
at com.mysql.cj.NativeSession.connect(NativeSession.java:144)  
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956)  
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826)  
… 19 more  
Caused by: java.net.SocketTimeoutException: connect timed out  
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)  
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)  
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)  
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)  
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)  
at java.net.PlainSocketImpl.connect(Unknown Source)  
at java.net.SocksSocketImpl.connect(Unknown Source)  
at java.net.Socket.connect(Unknown Source)  
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)  
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)  
… 22 more

7.9.9 (b2018081621)  
Oracle Corporation 1.8.0\_271

I can read/write into the Database from other aplications but I cant in Igntion

Some things i already tried:

- Ensured the username and password matches the one I use in my DB and has all the privileges granted
- Added bind-address=“0.0.0.0” in MySQL
- Updated MySQL ConnectorJ driver

Ignition version: **7.9.9 (b2018081621)**  
Java version: **Oracle Corporation 1.8.0\_271**

---

<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:** [April 1, 2022, 3:51pm UTC](https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935/2 "2022-04-01T15:51:49Z")

</div>

> [@Leonel\_Rodriguez](#):
>
> SocketTimeoutException: connect timed out

Pure network issue. Firewall, perhaps. ~~Or, more likely, the target database is not listening. IIRC, both MySQL and MariaDB default to listening only to localhost.~~

---

<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:** [April 1, 2022, 3:52pm UTC](https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935/3 "2022-04-01T15:52:34Z")

</div>

If you’re using Windows, you’ll also have Windows’ default firewall blocking external access on the port MySQL uses.

---

<div class="post-metadata">

**Author:** ![Leonel\_Rodriguez](https://avatars.discourse-cdn.com/v4/letter/l/a3d4f5/32.png) [@Leonel\_Rodriguez](https://forum.inductiveautomation.com/u/Leonel_Rodriguez)\
**Post date:** [April 1, 2022, 4:00pm UTC](https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935/4 "2022-04-01T16:00:59Z")

</div>

> [@paul-griffith](#):
>
> ySQL uses.

Thanks for the reply. My DB is running on a Raspberry Pi 3 with Ubuntu. As far as I know there is no firewall installed by default

---

<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:** [April 1, 2022, 4:03pm UTC](https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935/5 "2022-04-01T16:03:48Z")

</div>

Is your gateway on Windows? If so, does the service’s user have network privileges?

---

<div class="post-metadata">

**Author:** ![Leonel\_Rodriguez](https://avatars.discourse-cdn.com/v4/letter/l/a3d4f5/32.png) [@Leonel\_Rodriguez](https://forum.inductiveautomation.com/u/Leonel_Rodriguez)\
**Post date:** [April 1, 2022, 4:21pm UTC](https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935/6 "2022-04-01T16:21:18Z")

</div>

Yes it is on Windows  
Not sure if I understand the second question correctly  
The username I am using to try to stablish the connection is “Leonel” and I used the comand "GRANT ALL PRIVILEGES ON _._ TO ‘Leonel’@’%’; " in MySQL to give him privileges

---

<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:** [April 1, 2022, 4:25pm UTC](https://forum.inductiveautomation.com/t/cannot-create-poolableconnectionfactory-communications-link-failure-the-last-packet-sent-successfully-to-the-server-was-0-milliseconds-ago-the-driver-has-not-received-any-packets-from-the-server/57935/7 "2022-04-01T16:25:43Z")

</div>

No, I mean the user of Ignition itself. “LOCALSYSTEM” is typical. Which often does not have network privileges.

Also: You said other apps could talk to MySQL. Were they on the gateway system, or in the RPi ? If the latter, double check the RPi’s firewall, and use `netstat -l` to verify MySQL’s listening address.
