B4J Question [SOLVED] Error trying to get a connection pool

LucaMs

Expert
Licensed User
Longtime User
In a code module I have a regular routine containing only a Select.
I open a connection to the db (MySql) and I close it after the query execution.

B4X:
Sub XYZ

    Private sq As SQL = pool.GetConnection
    '<...>
    Private Cursor As ResultSet = sq.ExecQuery(Query)
    '<...>
    sq.Close

End Sub

Exactly at the fifteenth call to this routine I get the timeout error while trying to get a connection:

Error occurred on line: 223 (modDB)
java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
...
at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
...
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@2ef9b8bc -- timeout at awaitAvailable()


(line 223 Private sq As SQL = pool.GetConnection).


It's not a time matter, I tried to wait between the calls.

It's possible that the Close statement does not release the connection?

[mysql-connector-java-5.1.32-bin.jar]
 
Last edited:
Top