[PAX-JDBC] connection pool problem

157 views
Skip to first unread message

Luigi Caligiuri

unread,
Sep 16, 2020, 10:14:49 AM9/16/20
to OPS4J
I'm workin on an application deployed on karaf 4.2.9 and I'm using org.ops4j.pax.jdbc-1.4.4.

I've installed 
pax-jdbc-mariadb
pax-jdbc-pool-dbcp2
pax-jdbc-spec
pax-jdbc-config


I have a xa datasource for mariadb with this configuration:

osgi.jdbc.driver.name=mariadb
url=jdbc:mariadb://dbprimary:3306/gg_caibizdata?autoReconnect=true
user= xxxxxx
password=xxxxxx
dataSourceName=caibizdata
pool=dbcp2
jdbc.pool.maxTotal=100
jdbc.pool.maxIdle=7
jdbc.pool.maxWaitMillis=10000
xa=true
jdbc.factory.validationQuery="/* ping */ SELECT 1"

When karaf starts it doesn't create the connection, only when used for the first time using ds-list or by some bundle the connection is instantiated.
After some time, when every connection goes idle no other connection is created and if a bundle try to get a connection it receives a connection timeout, then if it tries another time everything goes well.
I've tried to set a minimum number of connections, bat i'ven't found the right property.
I've also tried to change the configuration using something like this

osgi.jdbc.driver.name=mariadb
url=jdbc:mariadb://dbprimary:3306/gg_caibizdata?autoReconnect=true
user=xxxxxxx
password=xxxxxx
dataSourceName=caibizdata
pool=dbcp2
pool.maxTotal=100
pool.minIdle=10
pool.maxWaitMillis=2000
pool.blockWhenExhausted = true
pool.testOnBorrow = true
pool.testWhileIdle = false
pool.timeBetweenEvictionRunsMillis = 120000
pool.evictionPolicyClassName = org.apache.commons.pool2.impl.DefaultEvictionPolicy
xa=true
jdbc.factory.validationQuery="/* ping */ SELECT 1"
jdbc.factory.maxConnLifetimeMillis = 30000
jdbc.factory.validationQueryTimeout = 2000
 
but nothing changes , and if I set both validationQUery and testOnBorrow the system could not create the connection.

What I'm doing wrong, can anyone help me?

Grzegorz Grzybek

unread,
Sep 16, 2020, 10:23:29 AM9/16/20
to op...@googlegroups.com
Hello

InitialSize was introduced in https://ops4j1.jira.com/browse/PAXJDBC-146, but only for pax-jdbc-pool-narayana. Looks like plain dbcp2 pool doesn't have this support...

regards
Grzegorz Grzybek

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/d0e5451b-ee8c-4642-be82-ff3210ec766cn%40googlegroups.com.

Luigi Caligiuri

unread,
Sep 16, 2020, 10:31:36 AM9/16/20
to op...@googlegroups.com
Hi Grzegorz,
thanks for your reply, I'll try narayana, but I,m curious to know why the system has this strange behaviour.

Luigi 

You received this message because you are subscribed to a topic in the Google Groups "OPS4J" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ops4j/PQxwctv8PYg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/CAAdXmhrsO3W1JCX05o%2BEwg7-NhFicurDXaYtgQoBoAUHTjtv-A%40mail.gmail.com.

Grzegorz Grzybek

unread,
Sep 16, 2020, 10:36:53 AM9/16/20
to op...@googlegroups.com
Hello

For this "strange behavior", I'd need to see some logs, or some kind of reproducer project ;)

regards
Grzegorz Grzybek

Luigi Caligiuri

unread,
Sep 18, 2020, 11:52:37 AM9/18/20
to OPS4J
Hi,
I've solved the problem.
In my installation were present 2 version of pax-jdbc.
I've removed the one not used and now all is ok.

Thanks for your help.
Luigi

Grzegorz Grzybek

unread,
Sep 18, 2020, 12:02:41 PM9/18/20
to op...@googlegroups.com
Hello

Great to hear that!

have a nice weekend
Grzegorz Grzybek

Reply all
Reply to author
Forward
0 new messages