B4J Question Database Connection Pool question

keirS

Well-Known Member
Licensed User
Longtime User
Is it possible to use a c3po-config.xml file to configure the connection pooling? I assume it would go in the files folder if it's possible.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Currently no.

The default settings are:
B4X:
     pool.setMaxStatements(150);
     pool.setMaxIdleTime(1800);
     pool.setIdleConnectionTestPeriod(600);
     pool.setCheckoutTimeout(20000);
     pool.setTestConnectionOnCheckout(true);

You can use JavaObject to call these or other methods: http://www.mchange.com/projects/c3p0/apidocs/com/mchange/v2/c3p0/ComboPooledDataSource.html

B4X:
Dim jo As JavaObject = pool
jo.RunMethod("setMaxIdleTime", Array As Object(3600))

Which settings do you need to change?
 
Upvote 0

keirS

Well-Known Member
Licensed User
Longtime User
I want to be able set the maxpoolsize as there is a connection limit per user on the DB server I am looking at ;and I don't want to adversely affect the other users in terms of performance.
 
Upvote 0

vfafou

Well-Known Member
Licensed User
Longtime User
I want to be able set the maxpoolsize as there is a connection limit per user on the DB server I am looking at ;and I don't want to adversely affect the other users in terms of performance.

Hello keirS.
I would like to ask you if it is correct to close the pool after every transaction!
And then, will the connection be done automatically with BeginTransaction?
Or I have to manually connect it again?

Thank you in advance!
 
Upvote 0

keirS

Well-Known Member
Licensed User
Longtime User
Hello keirS.
I would like to ask you if it is correct to close the pool after every transaction!
And then, will the connection be done automatically with BeginTransaction?
Or I have to manually connect it again?

Thank you in advance!

No. That would defeat the whole point of pooling.
 
Upvote 0
Top