Can I recommend the Apache Aries Transaction Control Project as a much simpler way to configure and manage JPA resources. This is the prototype Reference Implementation for the upcoming OSGi standard, and allows you to do all of your JPA configuration using Configuration Admin, rather than statically in the persistence.xml. It has built-in support for connection pooling, and provides active resource management so that you don’t need to worry about entitymanager/connection leaks.
Feel free to take a look at the documentation here: http://aries.apache.org/modules/transactioncontrol.html <http://aries.apache.org/modules/transactioncontrol.html> Regards, Tim > On 22 Dec 2016, at 07:30, Jörn Gersdorf <joern.gersd...@gmail.com> wrote: > > Hi Erwin, > > this is issue PAXJDBC-105 > <https://ops4j1.jira.com/projects/PAXJDBC/issues/PAXJDBC-105?filter=allissues> > which is fixed in not-yet-released master. > > Cheers > - Jörn > > On Thu, Dec 22, 2016 at 3:25 AM, Erwin Hogeweg <erwin.hoge...@me.com > <mailto:erwin.hoge...@me.com>> wrote: > After looking through the dbcp2 source code I discovered that the pool > properties need to be prepended by 'jdbc.' So: > > jdbc.pool.maxTotal=23 > jdbc.pool.maxIdle=-1 > > Even now that I know this I am unable to find any documentation describing > this properties (other than the GenericObjectPoolConfig JavaDoc. > > > Erwin > >> On Dec 21, 2016, at 11:04 AM, Erwin Hogeweg <erwin.hoge...@me.com >> <mailto:erwin.hoge...@me.com>> wrote: >> >> >> All, >> >> Apologies for cross-posting this from the opsj4 list. Hoping to reach a >> slightly bigger crowd here. >> >> The bottom line is that I can’t figure out how to configure more than 8 >> (anything else than 8 I should say) DB connections. >> >> Christian helped me out a while ago setting up a DataSource with mysql, and >> that works perfectly. However, now I need to increase the connection pool >> size but I can't figure it out. I tried a bunch of things, following the >> instructions on the wiki, but to no avail. I always see max. 8 connections >> in mysql workbench, no matter how many I have configured. >> >> I this in my datasource config: >> >> pool.initialSize=11 >> pool.maxTotal=23 >> >> and this in my persistence.xml: >> >> <!-- Configure connection pool. --> >> >> <property name="eclipselink.target-database" value="MYSQL" /> >> >> <property name="eclipselink.connection-pool.default.initial" value="1" >> /> >> >> <property name="eclipselink.connection-pool.default.min" value="64" /> >> >> <property name="eclipselink.connection-pool.default.max" value="64" /> >> >> >> These are the jdbc bundles: >> id State Bundle >> 57 ACTIVE org.ops4j.pax.jdbc_0.9.0 >> 58 ACTIVE org.ops4j.pax.jdbc.pool.dbcp2_0.9.0 >> 59 ACTIVE org.ops4j.pax.jdbc.config_0.9.0 >> 60 ACTIVE org.ops4j.pax.jdbc.pool.common_0.9.0 >> 63 ACTIVE com.mysql.jdbc_5.1.40 >> g! >> >> Just FYI - It doesn't make a difference when I include the pax-jdbc-mysql >> bundle because the com.mysql.jdbc also registers the DSFactories. >> >> And this is the DataSource service: >> g! services javax.sql.DataSource >> {javax.sql.DataSource}={user=user, osgi.jndi.service.name >> <http://osgi.jndi.service.name/>=jdbc/mynonjta, >> dataSourceName=jdbc/mynonjta, databaseName=database, >> url=jdbc:mysql://my_db_server: <>3306/database, >> service.pid=org.ops4j.datasource.81aed1e6-e5e3-4398-a67b-2e23b22e96b2, >> service.factoryPid=org.ops4j.datasource, password=password, >> pool.maxTotal=23, osgi.jdbc.driver.class=com.mysql.jdbc.Driver-pool, >> felix.fileinstall.filename=file:/Users/erwin/work/.../org.ops4j.datasource-my.cfg, >> pool.initialSize=11, service.id <http://service.id/>=139, >> service.bundleid=59, service.scope=singleton} >> "Registered by bundle:" org.ops4j.pax.jdbc.config_0.9.0 [59] >> "Bundles using service" >> org.apache.aries.jpa.container_2.3.0 [51] >> >> So everything works perfectly… with 8, and only 8 connections. >> >> Does anyone see what I am missing? >> >> As always, your help is greatly appreciated. >> >> BTW... I am using RESOURCE-LOCAL transaction-type. >> >> EL-2.6.2 >> Equinox-3.10 >> Java-8 >> MacOS Sierra >> >> >> Thanks and Happy Holidays, >> >> Erwin > >