[pax-jdbc] why there is no postgresql ?

198 views
Skip to first unread message

Kamesh Sampath

unread,
Jun 19, 2016, 1:03:05 AM6/19/16
to OPS4J
why did we not include postgresql driver as part of the drivers we provide ? is it OK if I can add the same to 0.9.0 release ?

-Kamesh

Christian Schneider

unread,
Jun 19, 2016, 1:58:32 AM6/19/16
to op...@googlegroups.com
Postgres now has native DataSourceFactory support. So we do not need to supply an Adapter anymore. If you look into the karaf feature you can see which db drivers still require the DSF adapter and which now are already compliant to the OSGi jdbc spec.

Christian

2016-06-19 7:03 GMT+02:00 Kamesh Sampath <kamesh....@gmail.com>:
why did we not include postgresql driver as part of the drivers we provide ? is it OK if I can add the same to 0.9.0 release ?

-Kamesh

--
--
------------------
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.
For more options, visit https://groups.google.com/d/optout.



--
--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com

Kamesh Sampath

unread,
Jun 19, 2016, 9:53:24 AM6/19/16
to OPS4J
thanks Christian ! makes sense.

Michael Täschner

unread,
Jun 21, 2016, 2:54:25 AM6/21/16
to op...@googlegroups.com
Hi Christian,

just for clarification: this means there is no option to configure PostGres datasources (and pooling) via PAX-JDBC? Do you see a possibility to combine native DSF with PAX-JDBC pooling and config ?

Thanks and Best Regards,
Michael

Christian Schneider

unread,
Jun 21, 2016, 3:27:00 AM6/21/16
to op...@googlegroups.com
The native DSF of Postgres should work with the pax-jdbc pooling and
config modules out of the box.

Christian

On 21.06.2016 08:54, Michael Täschner wrote:
> Hi Christian,
>
> just for clarification: this means there is no option to configure
> PostGres datasources (and pooling) via PAX-JDBC? Do you see a
> possibility to combine native DSF with PAX-JDBC pooling and config ?
>
> Thanks and Best Regards,
> Michael
>

Michael Täschner

unread,
Jun 21, 2016, 4:29:12 AM6/21/16
to op...@googlegroups.com
Hi Christian,

how is the postgres DSF referenced in the config ? Looking at my MySQL config I use the "mysql" + "pool" --> "osgi.jdbc.driver.name=mysql-pool". How would this work for postgres ?

Thanks and Best Regards,
Michael

Christian Schneider

unread,
Jun 21, 2016, 5:19:04 AM6/21/16
to op...@googlegroups.com
Install the postgres driver and look into its service properties. You use these properties to build osgi.jdbc.driver.name or osgi.jdbc.driver.class.
This will then use the plain DSF.
When you install the pool module it will create additional DSF services. You can look into these properties to see how they look like. You can then use these in the same way.

This works best in karaf as you have nice commands to look into the services.

For example:
feature:repo-add pax-jdbc 0.8.0
feature:install pax-jdbc-postgresql


karaf@root()> service:list DataSourceFactory
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.version = PostgreSQL 9.4 JDBC4.1 (build 1203)
 osgi.jdbc.driver.class = org.postgresql.Driver
 osgi.jdbc.driver.name = PostgreSQL JDBC Driver
 service.id = 269
 service.bundleid = 193
 service.scope = singleton
Provided by :
 PostgreSQL JDBC Driver JDBC41 (193)

This is the plain DSF.

You can address it using:

osgi.jdbc.driver.name=PostgreSQL JDBC Driver
or better
osgi.jdbc.driver.class = org.postgresql.Driver

When you now install_
feature:install pax-jdbc-pool-dbcp2
Then you have additional DSF services:

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 pooled = true
 osgi.jdbc.driver.class = org.postgresql.Driver-pool
 osgi.jdbc.driver.version = PostgreSQL 9.4 JDBC4.1 (build 1203)
 service.scope = singleton
 osgi.jdbc.driver.name = PostgreSQL JDBC Driver-pool
 service.bundleid = 197
 service.id = 283
Provided by :
 OPS4J Pax JDBC Pooling Support using Commons-DBCP2 (197)

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 pooled = true
 osgi.jdbc.driver.class = org.postgresql.Driver-pool-xa
 osgi.jdbc.driver.version = PostgreSQL 9.4 JDBC4.1 (build 1203)
 service.scope = singleton
 osgi.jdbc.driver.name = PostgreSQL JDBC Driver-pool-xa
 xa = true
 service.bundleid = 197
 service.id = 284
Provided by :
 OPS4J Pax JDBC Pooling Support using Commons-DBCP2 (197)

You can address these again with their driver.name and driver.class properties.
So the easiest way is to simply look into your running system.

Christian
Reply all
Reply to author
Forward
0 new messages