MySQL Database connection in DDF

150 views
Skip to first unread message

杨晨凯

unread,
Dec 8, 2016, 9:09:31 AM12/8/16
to ddf-dev...@googlegroups.com
I'm trying to develop database storage provider in DDF. But when I configure the data source for mysql database, the DDF.log gives the error "java.sql.SQLException: cannot set properties [configurationPid]".

The steps of configuration are just like the tutorial in Apache Karaf Tutorial Part 6 - Database Access

feature:repo-add mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.8.0/xml/features
feature:install transaction jndi pax-jdbc-mysql pax-jdbc-pool-dbcp2 pax-jdbc-config

It really works in Karaf since I have tried it in an independent Karaf. However, I get the mentioned error information in the log of DDF. 

I want to know if anyone has configured database in DDF and how to configure it. Thanks! 

By the way, the error information is given at the end.





Keith Wire

unread,
Dec 8, 2016, 10:42:16 AM12/8/16
to 杨晨凯, ddf-developers

Chenkai,

 

I dug into the issue you are seeing. It appears to be related to an issue where Karaf is adding a “confiurationPid” to prevent installing a configuration multiple times.  PAX JDBC forwards any additional properties to the DataSourceFactory which doesn’t know how to handle “configurationPid”.

 

The instructions you linked to are specific to Karaf 3.0.x while DDF is built upon Karaf 4.0.x which is likely why it works in Karaf but not DDF.  According to github, it is still possible to create a DataSource via blueprint although it is considered deprecated.  It may get you passed this issue. https://github.com/cschneider/Karaf-Tutorial/tree/master/db/datasource

 

I would recommend following this bug ticket for more information: https://issues.apache.org/jira/browse/KARAF-4124

PAX JDBC documentation for your reference: https://ops4j1.jira.com/wiki/display/PAXJDBC/Create+DataSource+from+config

 

I would be curious to know what you want to use MySQL for and if the same goals could be accomplished using the included SolrCatalogProvider in DDF as an alternative.

 

For reference here is what I did to reproduce the error:

1.       Edit org.ops4j.pax.url.mvn.cfg and uncomment the last property “org.ops4j.pax.url.mvn.cfg” and its values.

2.       Start DDF

3.       feature:repo-add mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.8.0/xml/features

4.       feature:repo-add org.apache.karaf.features/enterprise/4.0.7/xml/features

5.       feature:install transaction jndi pax-jdbc-mysql pax-jdbc-pool-dbcp2 pax-jdbc-config

 

--Keith

 

From: <ddf-dev...@googlegroups.com> on behalf of 杨晨凯 <ckya...@gmail.com>
Date: Thursday, December 8, 2016 at 7:09 AM
To: ddf-developers <ddf-dev...@googlegroups.com>
Subject: MySQL Database connection in DDF

 

I'm trying to develop database storage provider in DDF. But when I configure the data source for mysql database, the DDF.log gives the error "java.sql.SQLException: cannot set properties [configurationPid]".

 

The steps of configuration are just like the tutorial in Apache Karaf Tutorial Part 6 - Database Access

 

feature:repo-add mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.8.0/xml/features

feature:install transaction jndi pax-jdbc-mysql pax-jdbc-pool-dbcp2 pax-jdbc-config

 

It really works in Karaf since I have tried it in an independent Karaf. However, I get the mentioned error information in the log of DDF. 

 

I want to know if anyone has configured database in DDF and how to configure it. Thanks! 

 

By the way, the error information is given at the end.

 

 

--
You received this message because you are subscribed to the Google Groups "ddf-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ddf-developer...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stanley Dam

unread,
Jun 8, 2017, 12:14:27 AM6/8/17
to ddf-developers, ckya...@gmail.com
Has this issue been resolved? I am running into the same problem, not only with MySQL but also PostgreSQL. I looked at the DDF source code (version 2.9.4) and I believe the issue was caused by DDF, and not Karaf. If you take a look at this class platform/admin/core/admin-core-configpidplugin/src/main/java/org/codice/ddf/admin/configuration/plugin/ConfigPidConfigurationPlugin.java you know what I mean. If "configurationPid" is really needed, then add something in front to make it non local  (something like "service.configurationPid"), then Pax JDBC will not forward it to the DataSourceFactory. PAX JDBC only forwards non local keys.

Thanks,
SD

Scott Tustison

unread,
Jun 8, 2017, 9:04:00 AM6/8/17
to ddf-developers
That plugin is used for Configuration Admin and should have nothing to do with connecting up DDF to a data store other than Solr.

Stanley Dam

unread,
Jun 8, 2017, 9:11:58 AM6/8/17
to Scott Tustison, ddf-developers
Scott,

Thanks for your reply. If that's the case, do you know where configurationPid key gets ingested into the Properties that is passed to DataSourceFactory?

Has anyone successfully used PAX JDBC to create a DataSource by dropping the cfg file in DDF_HOME/etc/directory?


On Jun 8, 2017 8:04 AM, "Scott Tustison" <scott.t...@connexta.com> wrote:
That plugin is used for Configuration Admin and should have nothing to do with connecting up DDF to a data store other than Solr.

--
You received this message because you are subscribed to a topic in the Google Groups "ddf-developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ddf-developers/RPEqdMQEijg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ddf-developers+unsubscribe@googlegroups.com.

Stanley Dam

unread,
Jun 12, 2017, 2:05:59 PM6/12/17
to ddf-developers, scott.t...@connexta.com
Anyone?
Reply all
Reply to author
Forward
0 new messages