B4J Question MySQL Connection Pool

Eumel

Active Member
Licensed User
Longtime User
Is it possible to find via code, how many connections a webapp currently use ?

Since ABMaterial 2.0 i have to restart my webapp all 4-5 days because of

B4X:
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.

I checked my code carefully for open SQL connections or resultsets, but they are closed after use.

So i think, eventually there is an unknown error somewhere that let the programm jump out a routine before closing the connection or something else .

So i would like to put in some controllcode, that show the actually open connections.

Can someone help ?

------------
Eumel
 

Squiffy

Active Member
Licensed User
Longtime User
This will show some of what you're asking for :

B4X:
    Dim jo As JavaObject =Main.dbpool

    Log("Failed Data : pool connections = " & jo.RunMethod("getNumConnections",Null) & " out of a max. " & jo.RunMethod("getMaxPoolSize",Null))

(lifted straight out of my app)
 
Upvote 0

Eumel

Active Member
Licensed User
Longtime User
B4X:
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Method: getNumConnections not found in: anywheresoftware.b4j.objects.SQL

Hmmm .. Not found . I´m using jSQL 1.30
 
Upvote 0

Squiffy

Active Member
Licensed User
Longtime User
Are you assigning your pool object to the JO you create?

Contrived snippet :

B4X:
Dim dbpool As ConnectionPool
dbpool.Initialize(DriverClass,JdbcUrl,DBUser,DBPassword)

dim jo as JavaObject = dbpool
 
Upvote 0
Top