You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Alex Soto <al...@envieta.com> on 2019/02/01 17:48:49 UTC

OPS4J Pax JDBC + Derby = Duplicate DataSource

Hello,

I am experiencing a problem where pax-jdbc-config (version 1.3.0) is creating duplicate Derby Data Sources.  I copy the data source configuration file to  Karaf's etc/ directory, after a while I can see it created two identical Data Sources.

The configuration file: org.ops4j.datasource-querier.cfg

osgi.jdbc.driver.name = derby
dataSourceName=querier
url=jdbc:derby:derby-data/querier;create=true

user=enquery
password=XXXX
databaseName=querier

ops4j.preHook=querierDB

It creates duplicate Data Sources:

karaf@root()> service:list DataSource                                                                                                                                                                                      
[javax.sql.DataSource]
----------------------
 databaseName = querier
 dataSourceName = querier
 felix.fileinstall.filename = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
 ops4j.preHook = querierDB
 osgi.jdbc.driver.name = derby
 osgi.jndi.service.name = querier
 password = enquery
 pax.jdbc.managed = true
 service.bundleid = 169
 service.factoryPid = org.ops4j.datasource
 service.id = 238
 service.pid = org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
 service.scope = singleton
 url = jdbc:derby:derby-data/querier;create=true
 user = enquery
Provided by : 
 OPS4J Pax JDBC Config (169)
Used by: 
 JPA (22)
[javax.sql.DataSource]
----------------------
 databaseName = querier
 dataSourceName = querier
 felix.fileinstall.filename = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
 ops4j.preHook = querierDB
 osgi.jdbc.driver.name = derby
 osgi.jndi.service.name = querier
 password = enquery
 pax.jdbc.managed = true
 service.bundleid = 169
 service.factoryPid = org.ops4j.datasource
 service.id = 282
 service.pid = org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
 service.scope = singleton
 url = jdbc:derby:derby-data/querier;create=true
 user = enquery
Provided by : 
 OPS4J Pax JDBC Config (169)

Also:

karaf@root()> jdbc:ds-list
Name    │ Product      │ Version               │ URL                           │ Status
────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
querier │ Apache Derby │ 10.13.1.1 - (1765088) │ jdbc:derby:derby-data/querier │ OK
querier │ Apache Derby │ 10.13.1.1 - (1765088) │ jdbc:derby:derby-data/querier │ OK


I think it must be specific to Derby, as the same works fine if the driver is MariaDB.
Any clues?

Best regards,
Alex soto





Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
It would certainly require a new pax-jdbc release.

Anyway, it's not a blocker IMHO (having two service is not a big deal).

I hope to fix that today in order to include in Karaf 4.2.3 release.

Regards
JB

On 01/02/2019 19:10, Alex Soto wrote:
> Oh, thanks!
> 
> Can you suggest a work around? 
> What s the ETA for a fix? 
> I have a release deadline looming and I am afraid I can't wait too long.  
> 
> Thank you for the prompt response.
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>> <ma...@nanthrax.net>> wrote:
>>
>> Indeed, I can reproduce the issue embedded:
>>
>> Name    │ Service Id │ Product      │ Version               │ URL
>>                    │ Status
>> ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>> jdbc:derby:derby-data/querier │ OK
>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>> jdbc:derby:derby-data/querier │ OK
>>
>> I will fix that.
>>
>> Regards
>> JB
>>
>> On 01/02/2019 19:01, Alex Soto wrote:
>>>> How to do you provision the datasource cfg file ?
>>>> Using a feature or by dropping the file in the etc folder ?
>>>
>>>
>>> Dropping file in the etc/ directory
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>> <ma...@nanthrax.net>
>>>> <ma...@nanthrax.net>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>
>>>> If you install an unique provider (only derby or derbyclient, but not
>>>> both), then, it should work.
>>>>
>>>> I did:
>>>>
>>>> feature:install pax-jdbc-derbyclient
>>>>
>>>> then:
>>>>
>>>> jdbc:ds-create -dn derbyclient -url jdbc:derby://localhost:1527/foo foo
>>>>
>>>> And I see only one datasource service:
>>>>
>>>> karaf@root()> jdbc:ds-list
>>>> Name      │ Service Id │ Product      │ Version               │ URL
>>>>                              │ Status
>>>> ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>
>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>> bootstrap two db.  How to do you provision the datasource cfg file ?
>>>> Using a feature or by dropping the file in the etc folder ?
>>>>
>>>> I will check when my build is complete.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>> Hello,
>>>>>
>>>>> I am experiencing a problem where /pax-jdbc-config/ (version 1.3.0) is
>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>> can see
>>>>> it created two identical Data Sources.
>>>>>
>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>
>>>>>    osgi.jdbc.driver.name = derby
>>>>>    dataSourceName=querier
>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>
>>>>>    user=enquery
>>>>>    password=XXXX
>>>>>    databaseName=querier
>>>>>
>>>>>    ops4j.preHook=querierDB
>>>>>
>>>>>
>>>>> It creates duplicate Data Sources:
>>>>>
>>>>>    karaf@root()> service:list DataSource                              
>>>>>                                                                       
>>>>>                                                                       
>>>>>                   
>>>>>    [javax.sql.DataSource]
>>>>>    ----------------------
>>>>>     databaseName = querier
>>>>>     dataSourceName = querier
>>>>>     felix.fileinstall.filename =
>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>     ops4j.preHook = querierDB
>>>>>     osgi.jdbc.driver.name = derby
>>>>>     osgi.jndi.service.name = querier
>>>>>     password = enquery
>>>>>     pax.jdbc.managed = true
>>>>>     service.bundleid = 169
>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>     service.id
>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>> <http://service.id/>
>>>>> <http://service.id/>> = 238
>>>>>     service.pid =
>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>     service.scope = singleton
>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>     user = enquery
>>>>>    Provided by : 
>>>>>     OPS4J Pax JDBC Config (169)
>>>>>    Used by: 
>>>>>     JPA (22)
>>>>>    [javax.sql.DataSource]
>>>>>    ----------------------
>>>>>     databaseName = querier
>>>>>     dataSourceName = querier
>>>>>     felix.fileinstall.filename
>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>     ops4j.preHook = querierDB
>>>>>     osgi.jdbc.driver.name = derby
>>>>>     osgi.jndi.service.name = querier
>>>>>     password = enquery
>>>>>     pax.jdbc.managed = true
>>>>>     service.bundleid = 169
>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>     service.id
>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>> <http://service.id/>
>>>>> <http://service.id/>> = 282
>>>>>     service.pid =
>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>     service.scope = singleton
>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>     user = enquery
>>>>>    Provided by : 
>>>>>     OPS4J Pax JDBC Config (169)
>>>>>
>>>>>
>>>>> Also:
>>>>>
>>>>>    karaf@root()> jdbc:ds-list
>>>>>    Name    │ Product      │ Version               │ URL                
>>>>>              │ Status
>>>>>    ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>
>>>>>
>>>>>
>>>>> I think it must be specific to Derby, as the same works fine if the
>>>>> driver is MariaDB.
>>>>> Any clues?
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> Jean-Baptiste Onofré
>>>> jbonofre@apache.org
>>>> <ma...@apache.org> <ma...@apache.org>
>>>> http://blog.nanthrax.net
>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>> Talend - http://www.talend.com
>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbonofre@apache.org <ma...@apache.org>
>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>> Talend - http://www.talend.com <http://www.talend.com/>
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Just to illustrate, on a freshly built 4.2.3-SNAPSHOT:

karaf@root()> feature:install jdbc
karaf@root()> feature:install pax-jdbc-derby
karaf@root()> la|grep -i derby
52 │ Active   │  80 │ 10.14.2000000.1828579 │ Apache Derby 10.14
karaf@root()> bundle:services -p 52

Apache Derby 10.14 (52) provides:
---------------------------------
objectClass = [org.osgi.service.jdbc.DataSourceFactory]
osgi.jdbc.driver.class = org.apache.derby.jdbc.AutoloadedDriver
osgi.jdbc.driver.name = derby
osgi.jdbc.driver.version = 10.14.2000000.1828579
service.bundleid = 52
service.id = 89
service.scope = singleton
karaf@root()> jdbc:ds-create -dn derby -url "jdbc:derby:foo;create=true" foo
karaf@root()> jdbc:ds-list
Name │ Service Id │ Product      │ Version               │ URL
  │ Status
─────┼────────────┼──────────────┼───────────────────────┼────────────────┼───────
foo  │ 90         │ Apache Derby │ 10.14.2.0 - (1828579) │
jdbc:derby:foo │ OK
karaf@root()> jdbc:ds-info foo
Property       │ Value
───────────────┼──────────────────────────────────
driver.version │ 10.14.2.0 - (1828579)
service.id     │ 90
db.version     │ 10.14.2.0 - (1828579)
name           │ foo
db.product     │ Apache Derby
url            │ jdbc:derby:foo
driver.name    │ Apache Derby Embedded JDBC Driver
username       │ APP

It looks good to me ;)

Regards
JB

On 04/02/2019 20:23, Benjamin Graf wrote:
> Hi JB,
> 
> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
> a DataSourceFactory registered. I also do not found any code in derby
> sources that does anything about that if do not install pax-jdbc  to get
> the Driver instrumented.
> 
> Regards
> 
> Benjamin
> 
> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>> already updated. So it will be included in 4.2.3 release that will be on
>> vote tonight.
>>
>> Regards
>> JB
>>
>> On 04/02/2019 16:27, Alex Soto wrote:
>>> Thank you all,
>>>
>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>> adding only the derby feature.
>>>
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>> <ma...@nanthrax.net>> wrote:
>>>>
>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>> pax-jdbc-derby from the feature.
>>>>>
>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>> to remove the adapter bundle.
>>>>>
>>>>> Christian
>>>>>
>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>
>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>> opposite).
>>>>>
>>>>>    Regards
>>>>>    JB
>>>>>
>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>> actually registers two DataSourceFactory services:
>>>>>>
>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>    (which
>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>
>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>    datasource per
>>>>>> factory.
>>>>>>
>>>>>> That's why it's only when you use derby and actually, the two
>>>>>    datasource
>>>>>> services come from the two factories.
>>>>>>
>>>>>> I'm fixing that.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>> Oh, thanks!
>>>>>>>
>>>>>>> Can you suggest a work around? 
>>>>>>> What s the ETA for a fix? 
>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>    too long.  
>>>>>>> Thank you for the prompt response.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Alex soto
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>
>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>
>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>                    │ Status
>>>>>>>>
>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>
>>>>>>>> I will fix that.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>
>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Alex soto
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>
>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>    but not
>>>>>>>>>> both), then, it should work.
>>>>>>>>>>
>>>>>>>>>> I did:
>>>>>>>>>>
>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>
>>>>>>>>>> then:
>>>>>>>>>>
>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>
>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>                  │ URL
>>>>>>>>>>                              │ Status
>>>>>>>>>>
>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>
>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>    file ?
>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>
>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>    1.3.0) is
>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>> can see
>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>
>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>
>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>
>>>>>>>>>>>    user=enquery
>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>
>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>
>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>             
>>>>>>>>>>>                                                             
>>>>>             
>>>>>>>>>>>                                                             
>>>>>             
>>>>>>>>>>>                   
>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>    ----------------------
>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>    querier
>>>>>>>>>>>     password = enquery
>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>     service.pid =
>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>     user = enquery
>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>    Used by: 
>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>    ----------------------
>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>    querier
>>>>>>>>>>>     password = enquery
>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>     service.pid =
>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>     user = enquery
>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Also:
>>>>>>>>>>>
>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>             
>>>>>>>>>>>              │ Status
>>>>>>>>>>>
>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>    if the
>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>> Any clues?
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>> Alex soto
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>    <ma...@apache.org>>
>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>> -- 
>>>>>>>> Jean-Baptiste Onofré
>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>> <ma...@apache.org>
>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>    --
>>>>>    Jean-Baptiste Onofré
>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>> <ma...@apache.org>
>>>>>    http://blog.nanthrax.net
>>>>>    Talend - http://www.talend.com
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> -- 
>>>>> Christian Schneider
>>>>> http://www.liquid-reality.de
>>>>>
>>>>> Computer Scientist
>>>>> http://www.adobe.com
>>>>>
>>>> -- 
>>>> Jean-Baptiste Onofré
>>>> jbonofre@apache.org <ma...@apache.org>
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Benjamin,

With Pax JDBC 1.3.3 ?

I tested in Karaf and it's covered by Pax JDBC itest.

I checked in Derby code, and there's the Activator that register the
AutoloaderDriver with the factory.

Let me double check but I'm surprised.

What did you do ?
feature:install jdbc
feature:install pax-jdbc-derby

Regards
JB

On 04/02/2019 20:23, Benjamin Graf wrote:
> Hi JB,
> 
> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
> a DataSourceFactory registered. I also do not found any code in derby
> sources that does anything about that if do not install pax-jdbc  to get
> the Driver instrumented.
> 
> Regards
> 
> Benjamin
> 
> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>> already updated. So it will be included in 4.2.3 release that will be on
>> vote tonight.
>>
>> Regards
>> JB
>>
>> On 04/02/2019 16:27, Alex Soto wrote:
>>> Thank you all,
>>>
>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>> adding only the derby feature.
>>>
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>> <ma...@nanthrax.net>> wrote:
>>>>
>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>> pax-jdbc-derby from the feature.
>>>>>
>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>> to remove the adapter bundle.
>>>>>
>>>>> Christian
>>>>>
>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>
>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>> opposite).
>>>>>
>>>>>    Regards
>>>>>    JB
>>>>>
>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>> actually registers two DataSourceFactory services:
>>>>>>
>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>    (which
>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>
>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>    datasource per
>>>>>> factory.
>>>>>>
>>>>>> That's why it's only when you use derby and actually, the two
>>>>>    datasource
>>>>>> services come from the two factories.
>>>>>>
>>>>>> I'm fixing that.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>> Oh, thanks!
>>>>>>>
>>>>>>> Can you suggest a work around? 
>>>>>>> What s the ETA for a fix? 
>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>    too long.  
>>>>>>> Thank you for the prompt response.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Alex soto
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>
>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>
>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>                    │ Status
>>>>>>>>
>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>
>>>>>>>> I will fix that.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>
>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Alex soto
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>
>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>    but not
>>>>>>>>>> both), then, it should work.
>>>>>>>>>>
>>>>>>>>>> I did:
>>>>>>>>>>
>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>
>>>>>>>>>> then:
>>>>>>>>>>
>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>
>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>                  │ URL
>>>>>>>>>>                              │ Status
>>>>>>>>>>
>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>
>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>    file ?
>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>
>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>    1.3.0) is
>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>> can see
>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>
>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>
>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>
>>>>>>>>>>>    user=enquery
>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>
>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>
>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>             
>>>>>>>>>>>                                                             
>>>>>             
>>>>>>>>>>>                                                             
>>>>>             
>>>>>>>>>>>                   
>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>    ----------------------
>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>    querier
>>>>>>>>>>>     password = enquery
>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>     service.pid =
>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>     user = enquery
>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>    Used by: 
>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>    ----------------------
>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>    querier
>>>>>>>>>>>     password = enquery
>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>     service.pid =
>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>     user = enquery
>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Also:
>>>>>>>>>>>
>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>             
>>>>>>>>>>>              │ Status
>>>>>>>>>>>
>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>    if the
>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>> Any clues?
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>> Alex soto
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>    <ma...@apache.org>>
>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>> -- 
>>>>>>>> Jean-Baptiste Onofré
>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>> <ma...@apache.org>
>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>    --
>>>>>    Jean-Baptiste Onofré
>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>> <ma...@apache.org>
>>>>>    http://blog.nanthrax.net
>>>>>    Talend - http://www.talend.com
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> -- 
>>>>> Christian Schneider
>>>>> http://www.liquid-reality.de
>>>>>
>>>>> Computer Scientist
>>>>> http://www.adobe.com
>>>>>
>>>> -- 
>>>> Jean-Baptiste Onofré
>>>> jbonofre@apache.org <ma...@apache.org>
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

pax-jdbc-config already comes with jdbc feature.

I know pooling doesn't work: that's an issue in the Derby bundle.
So, I took the decision to fix the dual DataSourceFactory issue, and I
created a Jira at Derby to fix the XA/Pooling issue.

Regards
JB

On 04/02/2019 20:57, Benjamin Graf wrote:
> Hi JB,
> 
> I install pax-jdbc-config and pax-jdbc-derby. After installing pax-jdbc
> I got the derby DataSourceFactory. IMHO pax-jdbc is not mandatory to
> install and pooling seems to not work either.
> 
> Regards
> 
> Benjamin
> 
> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>> By the way, Karaf example itest (jdbc example) use Derby without problem.
>>
>> Regards
>> JB
>>
>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>> Hi JB,
>>>
>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
>>> a DataSourceFactory registered. I also do not found any code in derby
>>> sources that does anything about that if do not install pax-jdbc  to get
>>> the Driver instrumented.
>>>
>>> Regards
>>>
>>> Benjamin
>>>
>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>>>> already updated. So it will be included in 4.2.3 release that will be on
>>>> vote tonight.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>> Thank you all,
>>>>>
>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>>>> adding only the derby feature.
>>>>>
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>
>>>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>
>>>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>>>> to remove the adapter bundle.
>>>>>>>
>>>>>>> Christian
>>>>>>>
>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>>>
>>>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>>>> opposite).
>>>>>>>
>>>>>>>    Regards
>>>>>>>    JB
>>>>>>>
>>>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>
>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>>>    (which
>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>
>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>    datasource per
>>>>>>>> factory.
>>>>>>>>
>>>>>>>> That's why it's only when you use derby and actually, the two
>>>>>>>    datasource
>>>>>>>> services come from the two factories.
>>>>>>>>
>>>>>>>> I'm fixing that.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>> Oh, thanks!
>>>>>>>>>
>>>>>>>>> Can you suggest a work around? 
>>>>>>>>> What s the ETA for a fix? 
>>>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>>>    too long.  
>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Alex soto
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>
>>>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>>>                    │ Status
>>>>>>>>>>
>>>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>
>>>>>>>>>> I will fix that.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>> Alex soto
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>
>>>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>>>    but not
>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>
>>>>>>>>>>>> I did:
>>>>>>>>>>>>
>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>
>>>>>>>>>>>> then:
>>>>>>>>>>>>
>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>
>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>                  │ URL
>>>>>>>>>>>>                              │ Status
>>>>>>>>>>>>
>>>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>
>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>>>    file ?
>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>
>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>
>>>>>>>>>>>> Regards
>>>>>>>>>>>> JB
>>>>>>>>>>>>
>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>>>    1.3.0) is
>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>>>> can see
>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>
>>>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>
>>>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>
>>>>>>>>>>>>>    user=enquery
>>>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>>>
>>>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>>>             
>>>>>>>>>>>>>                                                             
>>>>>>>             
>>>>>>>>>>>>>                                                             
>>>>>>>             
>>>>>>>>>>>>>                   
>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>    querier
>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>    Used by: 
>>>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>    querier
>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>>>             
>>>>>>>>>>>>>              │ Status
>>>>>>>>>>>>>
>>>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>>>    if the
>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>    <ma...@apache.org>>
>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>> -- 
>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>> <ma...@apache.org>
>>>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>    --
>>>>>>>    Jean-Baptiste Onofré
>>>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>>>> <ma...@apache.org>
>>>>>>>    http://blog.nanthrax.net
>>>>>>>    Talend - http://www.talend.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>>> -- 
>>>>>>> Christian Schneider
>>>>>>> http://www.liquid-reality.de
>>>>>>>
>>>>>>> Computer Scientist
>>>>>>> http://www.adobe.com
>>>>>>>
>>>>>> -- 
>>>>>> Jean-Baptiste Onofré
>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>> http://blog.nanthrax.net
>>>>>> Talend - http://www.talend.com

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks Benjamin,

much appreciated ;)

Regards
JB

On 04/02/2019 21:50, Benjamin Graf wrote:
> Hi JB,
> 
> OK, go for it and good night. :-)
> 
> Regards
> 
> Benjamin
> 
> Am 04.02.2019 um 21:47 schrieb Jean-Baptiste Onofré:
>> Indeed,
>>
>> It should work without the jdbc feature (Karaf one).
>>
>> I'm releasing Karaf 4.2.3 now (we are already late for this release).
>>
>> I'm gonna investigate the Derby case ;)
>>
>> Regards
>> JB
>>
>> On 04/02/2019 21:36, Benjamin Graf wrote:
>>> Hi,
>>>
>>> I'm a little bit confused:
>>>
>>> <feature name="pax-jdbc-spec" description="Provides OSGi JDBC Service
>>> spec" version="${project.version}">
>>>           <bundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
>>> </feature>
>>>
>>> <feature name="pax-jdbc-derby" description="Provides JDBC Derby Embedded
>>> DataSourceFactory" version="${project.version}">
>>>           <feature>pax-jdbc-spec</feature>
>>>
>>>           <bundle>mvn:org.apache.derby/derby/${derby.version}</bundle>
>>> </feature>
>>>
>>> pax-jdbc-derby still does install
>>> mvn:org.osgi/org.osgi.service.jdbc/x.x.x but not
>>> mvn:org.ops4j.pax.jdbc/pax-jdbc/x.x.x
>>>
>>> Regards
>>>
>>> Benjamin
>>>
>>> Am 04.02.2019 um 21:29 schrieb Jean-Baptiste Onofré:
>>>> Hi,
>>>>
>>>> Actually, this is because pax-jdbc-spec feature should have:
>>>>
>>>> <bundle
>>>> dependency="true">mvn:org.osgi/org.osgi.service.jdbc/${org.osgi.service.jdbc.version}</bundle>
>>>>
>>>>
>>>> That's why jdbc feature make things working.
>>>>
>>>> If you don't mind, I would like to release Karaf 4.2.3 like this (as
>>>> it works fine). In the mean time, I'm creating a Jira at Pax JDBC to
>>>> add the org.osgi.service.jdbc bundle in pax-jdbc-derby feature.
>>>>
>>>> OK ?
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 04/02/2019 21:24, Benjamin Graf wrote:
>>>>> Hi JB,
>>>>>
>>>>> I would suggest to add pax-jdbc feature as dependency to
>>>>> pax-jdbc-derby
>>>>> feature as it would work without. Just keep pax features independent
>>>>> from possible installed karaf feature.
>>>>>
>>>>> What do you think?
>>>>>
>>>>> Regards
>>>>>
>>>>> Benjamin
>>>>>
>>>>> Am 04.02.2019 um 21:20 schrieb Jean-Baptiste Onofré:
>>>>>> Hi Benjamin,
>>>>>>
>>>>>> Previously, pax-jdbc-derby feature also needed pax-jdbc feature.
>>>>>>
>>>>>> I directly installed the derby bundle, it uses dynamic import, that's
>>>>>> why it works with pax-jdbc-spec IMHO (with the package with
>>>>>> DataSourceFactory is there).
>>>>>>
>>>>>> So, I'm not sure to see your point: in previous version, you also
>>>>>> need
>>>>>> pax-jdbc to get the adapter working.
>>>>>>
>>>>>> What are you suggesting ?
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 04/02/2019 21:08, Benjamin Graf wrote:
>>>>>>> Hu JB,
>>>>>>>
>>>>>>> Just to summarize:
>>>>>>>
>>>>>>> Karaf jdbc installs pax-jdbc and pax-jdbc-config sub features.
>>>>>>> pax-jdbc
>>>>>>> is needed to get a DataSourceFactory instance for Driver only
>>>>>>> installations like Derby. Derby does not register a
>>>>>>> DataSourceFactory
>>>>>>> directly. But if you do not install jdbc and/or pax-jdbc you
>>>>>>> won't get
>>>>>>> the DataSourceFactory for Derby anymore. That IMHO is a break to
>>>>>>> previous versions using the pax-jdbc-derby adaptor.
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Benjamin
>>>>>>>
>>>>>>> Am 04.02.2019 um 21:03 schrieb Jean-Baptiste Onofré:
>>>>>>>> pax-jdbc installs the pax-jdbc-spec bundle, that's why.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 04/02/2019 20:59, Benjamin Graf wrote:
>>>>>>>>> This way pax-jdbc-derby also need pax-jdbc feature to get
>>>>>>>>> installed!
>>>>>>>>>
>>>>>>>>> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>>>>>>>>>> Hi JB,
>>>>>>>>>>
>>>>>>>>>> I install pax-jdbc-config and pax-jdbc-derby. After installing
>>>>>>>>>> pax-jdbc
>>>>>>>>>> I got the derby DataSourceFactory. IMHO pax-jdbc is not
>>>>>>>>>> mandatory to
>>>>>>>>>> install and pooling seems to not work either.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>>
>>>>>>>>>> Benjamin
>>>>>>>>>>
>>>>>>>>>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>>>>>>>>>> By the way, Karaf example itest (jdbc example) use Derby
>>>>>>>>>>> without problem.
>>>>>>>>>>>
>>>>>>>>>>> Regards
>>>>>>>>>>> JB
>>>>>>>>>>>
>>>>>>>>>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>>>>>>>>>> Hi JB,
>>>>>>>>>>>>
>>>>>>>>>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I
>>>>>>>>>>>> do not get
>>>>>>>>>>>> a DataSourceFactory registered. I also do not found any code
>>>>>>>>>>>> in derby
>>>>>>>>>>>> sources that does anything about that if do not install
>>>>>>>>>>>> pax-jdbc  to get
>>>>>>>>>>>> the Driver instrumented.
>>>>>>>>>>>>
>>>>>>>>>>>> Regards
>>>>>>>>>>>>
>>>>>>>>>>>> Benjamin
>>>>>>>>>>>>
>>>>>>>>>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>>>>>>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf
>>>>>>>>>>>>> 4.2.3-SNAPSHOT is
>>>>>>>>>>>>> already updated. So it will be included in 4.2.3 release that
>>>>>>>>>>>>> will be on
>>>>>>>>>>>>> vote tonight.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards
>>>>>>>>>>>>> JB
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>>>>>>>>>> Thank you all,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby
>>>>>>>>>>>>>> / and
>>>>>>>>>>>>>> adding only the derby feature.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré
>>>>>>>>>>>>>>> <jb@nanthrax.net
>>>>>>>>>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby
>>>>>>>>>>>>>>> feature but just
>>>>>>>>>>>>>>> installing the derby bundle (not the pax-jdbc wrapper
>>>>>>>>>>>>>>> bundle).
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>>>>>>>>>> If derby now provides a DataSourceFactory then we should
>>>>>>>>>>>>>>>> remove
>>>>>>>>>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I guess at some point derby started providing the DSF and
>>>>>>>>>>>>>>>> we just forgot
>>>>>>>>>>>>>>>> to remove the adapter bundle.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Christian
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste
>>>>>>>>>>>>>>>> Onofré
>>>>>>>>>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>>>> <ma...@nanthrax.net>>:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>       By the way, a simple workaround is to stop or even
>>>>>>>>>>>>>>>> remove the
>>>>>>>>>>>>>>>>       pax-jdbc-derby bundle, and use only the derby bundle
>>>>>>>>>>>>>>>> (or the
>>>>>>>>>>>>>>>> opposite).
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>       Regards
>>>>>>>>>>>>>>>>       JB
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>       On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>>>>>>>>>> OK, I think I found the problem: installing the
>>>>>>>>>>>>>>>>> pax-jdbc-derby feature
>>>>>>>>>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby
>>>>>>>>>>>>>>>>> bundle
>>>>>>>>>>>>>>>>       (which
>>>>>>>>>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby
>>>>>>>>>>>>>>>>> bundle
>>>>>>>>>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>       <http://osgi.jdbc.driver.name> service property.
>>>>>>>>>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>>>>>>>>>       datasource per
>>>>>>>>>>>>>>>>> factory.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> That's why it's only when you use derby and actually, the
>>>>>>>>>>>>>>>>> two
>>>>>>>>>>>>>>>>       datasource
>>>>>>>>>>>>>>>>> services come from the two factories.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I'm fixing that.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>>>>>>>>>> Oh, thanks!
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Can you suggest a work around?
>>>>>>>>>>>>>>>>>> What s the ETA for a fix?
>>>>>>>>>>>>>>>>>> I have a release deadline looming and I am afraid I
>>>>>>>>>>>>>>>>>> can't wait
>>>>>>>>>>>>>>>>       too long.
>>>>>>>>>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>       <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>>>> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Name    │ Service Id │ Product      │ Version
>>>>>>>>>>>>>>>>>>>                 │ URL
>>>>>>>>>>>>>>>>>>>                       │ Status
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>       ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 -
>>>>>>>>>>>>>>>>>>> (1765088) │
>>>>>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 -
>>>>>>>>>>>>>>>>>>> (1765088) │
>>>>>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I will fix that.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc
>>>>>>>>>>>>>>>>>>>>> folder ?
>>>>>>>>>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>       <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>>>> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource
>>>>>>>>>>>>>>>>>>>>> (on Karaf
>>>>>>>>>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> If you install an unique provider (only derby or
>>>>>>>>>>>>>>>>>>>>> derbyclient,
>>>>>>>>>>>>>>>>       but not
>>>>>>>>>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> then:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>>>>>>>>>       jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>>>>>>>>>                     │ URL
>>>>>>>>>>>>>>>>>>>>>                                 │ Status
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>       ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 -
>>>>>>>>>>>>>>>>>>>>> (1828579) │
>>>>>>>>>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in
>>>>>>>>>>>>>>>>>>>>> cause, like it
>>>>>>>>>>>>>>>>>>>>> bootstrap two db.  How to do you provision the
>>>>>>>>>>>>>>>>>>>>> datasource cfg
>>>>>>>>>>>>>>>>       file ?
>>>>>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc
>>>>>>>>>>>>>>>>>>>>> folder ?
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> I am experiencing a problem
>>>>>>>>>>>>>>>>>>>>>> where /pax-jdbc-config/ (version
>>>>>>>>>>>>>>>>       1.3.0) is
>>>>>>>>>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the
>>>>>>>>>>>>>>>>>>>>>> data source
>>>>>>>>>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory,
>>>>>>>>>>>>>>>>>>>>>> after a while I
>>>>>>>>>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> The configuration
>>>>>>>>>>>>>>>>>>>>>> file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>       osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>>>       dataSourceName=querier
>>>>>>>>>>>>>>>>>>>>>>       url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>       user=enquery
>>>>>>>>>>>>>>>>>>>>>>       password=XXXX
>>>>>>>>>>>>>>>>>>>>>>       databaseName=querier
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>       ops4j.preHook=querierDB
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>       karaf@root()> service:list DataSource
>>>>>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>>>>>                                                              
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>>>>>                                                              
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>>>>>                          [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>>>>>       ----------------------
>>>>>>>>>>>>>>>>>>>>>>        databaseName = querier
>>>>>>>>>>>>>>>>>>>>>>        dataSourceName = querier
>>>>>>>>>>>>>>>>>>>>>>        felix.fileinstall.filename =
>>>>>>>>>>>>>>>>>>>>>>       file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>        ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>>>>>        osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>>>        osgi.jndi.service.name
>>>>>>>>>>>>>>>>>>>>>> <http://osgi.jndi.service.name> =
>>>>>>>>>>>>>>>>       querier
>>>>>>>>>>>>>>>>>>>>>>        password = enquery
>>>>>>>>>>>>>>>>>>>>>>        pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>>>>>        service.bundleid = 169
>>>>>>>>>>>>>>>>>>>>>>        service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>>>>>        service.id <http://service.id>
>>>>>>>>>>>>>>>>>>>>>> <http://service.id>
>>>>>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>>>>>>>>>        service.pid =
>>>>>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>        service.scope = singleton
>>>>>>>>>>>>>>>>>>>>>>        url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>>>        user = enquery
>>>>>>>>>>>>>>>>>>>>>>       Provided by :
>>>>>>>>>>>>>>>>>>>>>>        OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>>>>>       Used by:
>>>>>>>>>>>>>>>>>>>>>>        JPA (22)
>>>>>>>>>>>>>>>>>>>>>>       [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>>>>>       ----------------------
>>>>>>>>>>>>>>>>>>>>>>        databaseName = querier
>>>>>>>>>>>>>>>>>>>>>>        dataSourceName = querier
>>>>>>>>>>>>>>>>>>>>>>        felix.fileinstall.filename
>>>>>>>>>>>>>>>>>>>>>>       = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>        ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>>>>>        osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>>>        osgi.jndi.service.name
>>>>>>>>>>>>>>>>>>>>>> <http://osgi.jndi.service.name> =
>>>>>>>>>>>>>>>>       querier
>>>>>>>>>>>>>>>>>>>>>>        password = enquery
>>>>>>>>>>>>>>>>>>>>>>        pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>>>>>        service.bundleid = 169
>>>>>>>>>>>>>>>>>>>>>>        service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>>>>>        service.id <http://service.id>
>>>>>>>>>>>>>>>>>>>>>> <http://service.id>
>>>>>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>>>>>>>>>        service.pid =
>>>>>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>        service.scope = singleton
>>>>>>>>>>>>>>>>>>>>>>        url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>>>        user = enquery
>>>>>>>>>>>>>>>>>>>>>>       Provided by :
>>>>>>>>>>>>>>>>>>>>>>        OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>       karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>>>>>>       Name    │ Product      │ Version               │
>>>>>>>>>>>>>>>>>>>>>> URL
>>>>>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>>>>>                 │ Status
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>          ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>       querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>>>>>       jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>>>>       querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>>>>>       jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> I think it must be specific to Derby, as the same
>>>>>>>>>>>>>>>>>>>>>> works fine
>>>>>>>>>>>>>>>>       if the
>>>>>>>>>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>>>>>       <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>       <ma...@apache.org>>
>>>>>>>>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>>       <mailto:jbonofre@apache.org
>>>>>>>>>>>>>>>> <ma...@apache.org>>
>>>>>>>>>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>>>>>>>>>       --
>>>>>>>>>>>>>>>>       Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>       jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>>       http://blog.nanthrax.net
>>>>>>>>>>>>>>>>       Talend - http://www.talend.com
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>> Christian Schneider
>>>>>>>>>>>>>>>> http://www.liquid-reality.de
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Computer Scientist
>>>>>>>>>>>>>>>> http://www.adobe.com
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Benjamin Graf <be...@gmx.net>.
Hi JB,

OK, go for it and good night. :-)

Regards

Benjamin

Am 04.02.2019 um 21:47 schrieb Jean-Baptiste Onofré:
> Indeed,
>
> It should work without the jdbc feature (Karaf one).
>
> I'm releasing Karaf 4.2.3 now (we are already late for this release).
>
> I'm gonna investigate the Derby case ;)
>
> Regards
> JB
>
> On 04/02/2019 21:36, Benjamin Graf wrote:
>> Hi,
>>
>> I'm a little bit confused:
>>
>> <feature name="pax-jdbc-spec" description="Provides OSGi JDBC Service
>> spec" version="${project.version}">
>>          <bundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
>> </feature>
>>
>> <feature name="pax-jdbc-derby" description="Provides JDBC Derby Embedded
>> DataSourceFactory" version="${project.version}">
>>          <feature>pax-jdbc-spec</feature>
>>
>>          <bundle>mvn:org.apache.derby/derby/${derby.version}</bundle>
>> </feature>
>>
>> pax-jdbc-derby still does install
>> mvn:org.osgi/org.osgi.service.jdbc/x.x.x but not
>> mvn:org.ops4j.pax.jdbc/pax-jdbc/x.x.x
>>
>> Regards
>>
>> Benjamin
>>
>> Am 04.02.2019 um 21:29 schrieb Jean-Baptiste Onofré:
>>> Hi,
>>>
>>> Actually, this is because pax-jdbc-spec feature should have:
>>>
>>> <bundle
>>> dependency="true">mvn:org.osgi/org.osgi.service.jdbc/${org.osgi.service.jdbc.version}</bundle>
>>>
>>>
>>> That's why jdbc feature make things working.
>>>
>>> If you don't mind, I would like to release Karaf 4.2.3 like this (as
>>> it works fine). In the mean time, I'm creating a Jira at Pax JDBC to
>>> add the org.osgi.service.jdbc bundle in pax-jdbc-derby feature.
>>>
>>> OK ?
>>>
>>> Regards
>>> JB
>>>
>>> On 04/02/2019 21:24, Benjamin Graf wrote:
>>>> Hi JB,
>>>>
>>>> I would suggest to add pax-jdbc feature as dependency to
>>>> pax-jdbc-derby
>>>> feature as it would work without. Just keep pax features independent
>>>> from possible installed karaf feature.
>>>>
>>>> What do you think?
>>>>
>>>> Regards
>>>>
>>>> Benjamin
>>>>
>>>> Am 04.02.2019 um 21:20 schrieb Jean-Baptiste Onofré:
>>>>> Hi Benjamin,
>>>>>
>>>>> Previously, pax-jdbc-derby feature also needed pax-jdbc feature.
>>>>>
>>>>> I directly installed the derby bundle, it uses dynamic import, that's
>>>>> why it works with pax-jdbc-spec IMHO (with the package with
>>>>> DataSourceFactory is there).
>>>>>
>>>>> So, I'm not sure to see your point: in previous version, you also
>>>>> need
>>>>> pax-jdbc to get the adapter working.
>>>>>
>>>>> What are you suggesting ?
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> On 04/02/2019 21:08, Benjamin Graf wrote:
>>>>>> Hu JB,
>>>>>>
>>>>>> Just to summarize:
>>>>>>
>>>>>> Karaf jdbc installs pax-jdbc and pax-jdbc-config sub features.
>>>>>> pax-jdbc
>>>>>> is needed to get a DataSourceFactory instance for Driver only
>>>>>> installations like Derby. Derby does not register a
>>>>>> DataSourceFactory
>>>>>> directly. But if you do not install jdbc and/or pax-jdbc you
>>>>>> won't get
>>>>>> the DataSourceFactory for Derby anymore. That IMHO is a break to
>>>>>> previous versions using the pax-jdbc-derby adaptor.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Benjamin
>>>>>>
>>>>>> Am 04.02.2019 um 21:03 schrieb Jean-Baptiste Onofré:
>>>>>>> pax-jdbc installs the pax-jdbc-spec bundle, that's why.
>>>>>>>
>>>>>>> Regards
>>>>>>> JB
>>>>>>>
>>>>>>> On 04/02/2019 20:59, Benjamin Graf wrote:
>>>>>>>> This way pax-jdbc-derby also need pax-jdbc feature to get
>>>>>>>> installed!
>>>>>>>>
>>>>>>>> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>>>>>>>>> Hi JB,
>>>>>>>>>
>>>>>>>>> I install pax-jdbc-config and pax-jdbc-derby. After installing
>>>>>>>>> pax-jdbc
>>>>>>>>> I got the derby DataSourceFactory. IMHO pax-jdbc is not
>>>>>>>>> mandatory to
>>>>>>>>> install and pooling seems to not work either.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>>
>>>>>>>>> Benjamin
>>>>>>>>>
>>>>>>>>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>>>>>>>>> By the way, Karaf example itest (jdbc example) use Derby
>>>>>>>>>> without problem.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>>>>>>>>> Hi JB,
>>>>>>>>>>>
>>>>>>>>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I
>>>>>>>>>>> do not get
>>>>>>>>>>> a DataSourceFactory registered. I also do not found any code
>>>>>>>>>>> in derby
>>>>>>>>>>> sources that does anything about that if do not install
>>>>>>>>>>> pax-jdbc  to get
>>>>>>>>>>> the Driver instrumented.
>>>>>>>>>>>
>>>>>>>>>>> Regards
>>>>>>>>>>>
>>>>>>>>>>> Benjamin
>>>>>>>>>>>
>>>>>>>>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>>>>>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf
>>>>>>>>>>>> 4.2.3-SNAPSHOT is
>>>>>>>>>>>> already updated. So it will be included in 4.2.3 release that
>>>>>>>>>>>> will be on
>>>>>>>>>>>> vote tonight.
>>>>>>>>>>>>
>>>>>>>>>>>> Regards
>>>>>>>>>>>> JB
>>>>>>>>>>>>
>>>>>>>>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>>>>>>>>> Thank you all,
>>>>>>>>>>>>>
>>>>>>>>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby
>>>>>>>>>>>>> / and
>>>>>>>>>>>>> adding only the derby feature.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré
>>>>>>>>>>>>>> <jb@nanthrax.net
>>>>>>>>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby
>>>>>>>>>>>>>> feature but just
>>>>>>>>>>>>>> installing the derby bundle (not the pax-jdbc wrapper
>>>>>>>>>>>>>> bundle).
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>>>>>>>>> If derby now provides a DataSourceFactory then we should
>>>>>>>>>>>>>>> remove
>>>>>>>>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I guess at some point derby started providing the DSF and
>>>>>>>>>>>>>>> we just forgot
>>>>>>>>>>>>>>> to remove the adapter bundle.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Christian
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste
>>>>>>>>>>>>>>> Onofré
>>>>>>>>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>>> <ma...@nanthrax.net>>:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>      By the way, a simple workaround is to stop or even
>>>>>>>>>>>>>>> remove the
>>>>>>>>>>>>>>>      pax-jdbc-derby bundle, and use only the derby bundle
>>>>>>>>>>>>>>> (or the
>>>>>>>>>>>>>>> opposite).
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>      Regards
>>>>>>>>>>>>>>>      JB
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>      On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>>>>>>>>> OK, I think I found the problem: installing the
>>>>>>>>>>>>>>>> pax-jdbc-derby feature
>>>>>>>>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby
>>>>>>>>>>>>>>>> bundle
>>>>>>>>>>>>>>>      (which
>>>>>>>>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby
>>>>>>>>>>>>>>>> bundle
>>>>>>>>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>>>>>>>>      <http://osgi.jdbc.driver.name> service property.
>>>>>>>>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>>>>>>>>      datasource per
>>>>>>>>>>>>>>>> factory.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> That's why it's only when you use derby and actually, the
>>>>>>>>>>>>>>>> two
>>>>>>>>>>>>>>>      datasource
>>>>>>>>>>>>>>>> services come from the two factories.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I'm fixing that.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>>>>>>>>> Oh, thanks!
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Can you suggest a work around?
>>>>>>>>>>>>>>>>> What s the ETA for a fix?
>>>>>>>>>>>>>>>>> I have a release deadline looming and I am afraid I
>>>>>>>>>>>>>>>>> can't wait
>>>>>>>>>>>>>>>      too long.
>>>>>>>>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>>>>      <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>>> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Name    │ Service Id │ Product      │ Version
>>>>>>>>>>>>>>>>>>                │ URL
>>>>>>>>>>>>>>>>>>                      │ Status
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>      ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 -
>>>>>>>>>>>>>>>>>> (1765088) │
>>>>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 -
>>>>>>>>>>>>>>>>>> (1765088) │
>>>>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I will fix that.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc
>>>>>>>>>>>>>>>>>>>> folder ?
>>>>>>>>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>>>>      <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>>> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource
>>>>>>>>>>>>>>>>>>>> (on Karaf
>>>>>>>>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> If you install an unique provider (only derby or
>>>>>>>>>>>>>>>>>>>> derbyclient,
>>>>>>>>>>>>>>>      but not
>>>>>>>>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> then:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>>>>>>>>      jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>>>>>>>>                    │ URL
>>>>>>>>>>>>>>>>>>>>                                │ Status
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>      ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 -
>>>>>>>>>>>>>>>>>>>> (1828579) │
>>>>>>>>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in
>>>>>>>>>>>>>>>>>>>> cause, like it
>>>>>>>>>>>>>>>>>>>> bootstrap two db.  How to do you provision the
>>>>>>>>>>>>>>>>>>>> datasource cfg
>>>>>>>>>>>>>>>      file ?
>>>>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc
>>>>>>>>>>>>>>>>>>>> folder ?
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> I am experiencing a problem
>>>>>>>>>>>>>>>>>>>>> where /pax-jdbc-config/ (version
>>>>>>>>>>>>>>>      1.3.0) is
>>>>>>>>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the
>>>>>>>>>>>>>>>>>>>>> data source
>>>>>>>>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory,
>>>>>>>>>>>>>>>>>>>>> after a while I
>>>>>>>>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> The configuration
>>>>>>>>>>>>>>>>>>>>> file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>      osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>>      dataSourceName=querier
>>>>>>>>>>>>>>>>>>>>>      url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>      user=enquery
>>>>>>>>>>>>>>>>>>>>>      password=XXXX
>>>>>>>>>>>>>>>>>>>>>      databaseName=querier
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>      ops4j.preHook=querierDB
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>      karaf@root()> service:list DataSource
>>>>>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>>>>>                                                             
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>>>>>                                                             
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>>>>>                         [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>>>>      ----------------------
>>>>>>>>>>>>>>>>>>>>>       databaseName = querier
>>>>>>>>>>>>>>>>>>>>>       dataSourceName = querier
>>>>>>>>>>>>>>>>>>>>>       felix.fileinstall.filename =
>>>>>>>>>>>>>>>>>>>>>      file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>       ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>>>>       osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>>       osgi.jndi.service.name
>>>>>>>>>>>>>>>>>>>>> <http://osgi.jndi.service.name> =
>>>>>>>>>>>>>>>      querier
>>>>>>>>>>>>>>>>>>>>>       password = enquery
>>>>>>>>>>>>>>>>>>>>>       pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>>>>       service.bundleid = 169
>>>>>>>>>>>>>>>>>>>>>       service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>>>>       service.id <http://service.id>
>>>>>>>>>>>>>>>>>>>>> <http://service.id>
>>>>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>>>>>>>>       service.pid =
>>>>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>       service.scope = singleton
>>>>>>>>>>>>>>>>>>>>>       url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>>       user = enquery
>>>>>>>>>>>>>>>>>>>>>      Provided by :
>>>>>>>>>>>>>>>>>>>>>       OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>>>>      Used by:
>>>>>>>>>>>>>>>>>>>>>       JPA (22)
>>>>>>>>>>>>>>>>>>>>>      [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>>>>      ----------------------
>>>>>>>>>>>>>>>>>>>>>       databaseName = querier
>>>>>>>>>>>>>>>>>>>>>       dataSourceName = querier
>>>>>>>>>>>>>>>>>>>>>       felix.fileinstall.filename
>>>>>>>>>>>>>>>>>>>>>      = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>       ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>>>>       osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>>       osgi.jndi.service.name
>>>>>>>>>>>>>>>>>>>>> <http://osgi.jndi.service.name> =
>>>>>>>>>>>>>>>      querier
>>>>>>>>>>>>>>>>>>>>>       password = enquery
>>>>>>>>>>>>>>>>>>>>>       pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>>>>       service.bundleid = 169
>>>>>>>>>>>>>>>>>>>>>       service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>>>>       service.id <http://service.id>
>>>>>>>>>>>>>>>>>>>>> <http://service.id>
>>>>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>>>>>>>>       service.pid =
>>>>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>       service.scope = singleton
>>>>>>>>>>>>>>>>>>>>>       url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>>       user = enquery
>>>>>>>>>>>>>>>>>>>>>      Provided by :
>>>>>>>>>>>>>>>>>>>>>       OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>      karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>>>>>      Name    │ Product      │ Version               │
>>>>>>>>>>>>>>>>>>>>> URL
>>>>>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>>>>>                │ Status
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>         ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>      querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>>>>      jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>>>      querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>>>>      jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> I think it must be specific to Derby, as the same
>>>>>>>>>>>>>>>>>>>>> works fine
>>>>>>>>>>>>>>>      if the
>>>>>>>>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>>>>      <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>      <ma...@apache.org>>
>>>>>>>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>      <mailto:jbonofre@apache.org
>>>>>>>>>>>>>>> <ma...@apache.org>>
>>>>>>>>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>>>>>>>>      --
>>>>>>>>>>>>>>>      Jean-Baptiste Onofré
>>>>>>>>>>>>>>>      jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>      http://blog.nanthrax.net
>>>>>>>>>>>>>>>      Talend - http://www.talend.com
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>> Christian Schneider
>>>>>>>>>>>>>>> http://www.liquid-reality.de
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Computer Scientist
>>>>>>>>>>>>>>> http://www.adobe.com
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Indeed,

It should work without the jdbc feature (Karaf one).

I'm releasing Karaf 4.2.3 now (we are already late for this release).

I'm gonna investigate the Derby case ;)

Regards
JB

On 04/02/2019 21:36, Benjamin Graf wrote:
> Hi,
> 
> I'm a little bit confused:
> 
> <feature name="pax-jdbc-spec" description="Provides OSGi JDBC Service
> spec" version="${project.version}">
>          <bundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
> </feature>
> 
> <feature name="pax-jdbc-derby" description="Provides JDBC Derby Embedded
> DataSourceFactory" version="${project.version}">
>          <feature>pax-jdbc-spec</feature>
> 
>          <bundle>mvn:org.apache.derby/derby/${derby.version}</bundle>
> </feature>
> 
> pax-jdbc-derby still does install
> mvn:org.osgi/org.osgi.service.jdbc/x.x.x but not
> mvn:org.ops4j.pax.jdbc/pax-jdbc/x.x.x
> 
> Regards
> 
> Benjamin
> 
> Am 04.02.2019 um 21:29 schrieb Jean-Baptiste Onofré:
>> Hi,
>>
>> Actually, this is because pax-jdbc-spec feature should have:
>>
>> <bundle
>> dependency="true">mvn:org.osgi/org.osgi.service.jdbc/${org.osgi.service.jdbc.version}</bundle>
>>
>> That's why jdbc feature make things working.
>>
>> If you don't mind, I would like to release Karaf 4.2.3 like this (as
>> it works fine). In the mean time, I'm creating a Jira at Pax JDBC to
>> add the org.osgi.service.jdbc bundle in pax-jdbc-derby feature.
>>
>> OK ?
>>
>> Regards
>> JB
>>
>> On 04/02/2019 21:24, Benjamin Graf wrote:
>>> Hi JB,
>>>
>>> I would suggest to add pax-jdbc feature as dependency to pax-jdbc-derby
>>> feature as it would work without. Just keep pax features independent
>>> from possible installed karaf feature.
>>>
>>> What do you think?
>>>
>>> Regards
>>>
>>> Benjamin
>>>
>>> Am 04.02.2019 um 21:20 schrieb Jean-Baptiste Onofré:
>>>> Hi Benjamin,
>>>>
>>>> Previously, pax-jdbc-derby feature also needed pax-jdbc feature.
>>>>
>>>> I directly installed the derby bundle, it uses dynamic import, that's
>>>> why it works with pax-jdbc-spec IMHO (with the package with
>>>> DataSourceFactory is there).
>>>>
>>>> So, I'm not sure to see your point: in previous version, you also need
>>>> pax-jdbc to get the adapter working.
>>>>
>>>> What are you suggesting ?
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 04/02/2019 21:08, Benjamin Graf wrote:
>>>>> Hu JB,
>>>>>
>>>>> Just to summarize:
>>>>>
>>>>> Karaf jdbc installs pax-jdbc and pax-jdbc-config sub features.
>>>>> pax-jdbc
>>>>> is needed to get a DataSourceFactory instance for Driver only
>>>>> installations like Derby. Derby does not register a DataSourceFactory
>>>>> directly. But if you do not install jdbc and/or pax-jdbc you won't get
>>>>> the DataSourceFactory for Derby anymore. That IMHO is a break to
>>>>> previous versions using the pax-jdbc-derby adaptor.
>>>>>
>>>>> Regards
>>>>>
>>>>> Benjamin
>>>>>
>>>>> Am 04.02.2019 um 21:03 schrieb Jean-Baptiste Onofré:
>>>>>> pax-jdbc installs the pax-jdbc-spec bundle, that's why.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 04/02/2019 20:59, Benjamin Graf wrote:
>>>>>>> This way pax-jdbc-derby also need pax-jdbc feature to get installed!
>>>>>>>
>>>>>>> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>>>>>>>> Hi JB,
>>>>>>>>
>>>>>>>> I install pax-jdbc-config and pax-jdbc-derby. After installing
>>>>>>>> pax-jdbc
>>>>>>>> I got the derby DataSourceFactory. IMHO pax-jdbc is not
>>>>>>>> mandatory to
>>>>>>>> install and pooling seems to not work either.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> Benjamin
>>>>>>>>
>>>>>>>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>>>>>>>> By the way, Karaf example itest (jdbc example) use Derby
>>>>>>>>> without problem.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> JB
>>>>>>>>>
>>>>>>>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>>>>>>>> Hi JB,
>>>>>>>>>>
>>>>>>>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I
>>>>>>>>>> do not get
>>>>>>>>>> a DataSourceFactory registered. I also do not found any code
>>>>>>>>>> in derby
>>>>>>>>>> sources that does anything about that if do not install
>>>>>>>>>> pax-jdbc  to get
>>>>>>>>>> the Driver instrumented.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>>
>>>>>>>>>> Benjamin
>>>>>>>>>>
>>>>>>>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>>>>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf
>>>>>>>>>>> 4.2.3-SNAPSHOT is
>>>>>>>>>>> already updated. So it will be included in 4.2.3 release that
>>>>>>>>>>> will be on
>>>>>>>>>>> vote tonight.
>>>>>>>>>>>
>>>>>>>>>>> Regards
>>>>>>>>>>> JB
>>>>>>>>>>>
>>>>>>>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>>>>>>>> Thank you all,
>>>>>>>>>>>>
>>>>>>>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby
>>>>>>>>>>>> / and
>>>>>>>>>>>> adding only the derby feature.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Best regards,
>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré
>>>>>>>>>>>>> <jb@nanthrax.net
>>>>>>>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby
>>>>>>>>>>>>> feature but just
>>>>>>>>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards
>>>>>>>>>>>>> JB
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>>>>>>>> If derby now provides a DataSourceFactory then we should
>>>>>>>>>>>>>> remove
>>>>>>>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I guess at some point derby started providing the DSF and
>>>>>>>>>>>>>> we just forgot
>>>>>>>>>>>>>> to remove the adapter bundle.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Christian
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste
>>>>>>>>>>>>>> Onofré
>>>>>>>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>> <ma...@nanthrax.net>>:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>      By the way, a simple workaround is to stop or even
>>>>>>>>>>>>>> remove the
>>>>>>>>>>>>>>      pax-jdbc-derby bundle, and use only the derby bundle
>>>>>>>>>>>>>> (or the
>>>>>>>>>>>>>> opposite).
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>      Regards
>>>>>>>>>>>>>>      JB
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>      On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>>>>>>>> OK, I think I found the problem: installing the
>>>>>>>>>>>>>>> pax-jdbc-derby feature
>>>>>>>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby
>>>>>>>>>>>>>>> bundle
>>>>>>>>>>>>>>      (which
>>>>>>>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby
>>>>>>>>>>>>>>> bundle
>>>>>>>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>>>>>>>      <http://osgi.jdbc.driver.name> service property.
>>>>>>>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>>>>>>>      datasource per
>>>>>>>>>>>>>>> factory.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> That's why it's only when you use derby and actually, the
>>>>>>>>>>>>>>> two
>>>>>>>>>>>>>>      datasource
>>>>>>>>>>>>>>> services come from the two factories.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I'm fixing that.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>>>>>>>> Oh, thanks!
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Can you suggest a work around?
>>>>>>>>>>>>>>>> What s the ETA for a fix?
>>>>>>>>>>>>>>>> I have a release deadline looming and I am afraid I
>>>>>>>>>>>>>>>> can't wait
>>>>>>>>>>>>>>      too long.
>>>>>>>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>>>      <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Name    │ Service Id │ Product      │ Version
>>>>>>>>>>>>>>>>>                │ URL
>>>>>>>>>>>>>>>>>                      │ Status
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>      ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 -
>>>>>>>>>>>>>>>>> (1765088) │
>>>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 -
>>>>>>>>>>>>>>>>> (1765088) │
>>>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I will fix that.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc
>>>>>>>>>>>>>>>>>>> folder ?
>>>>>>>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>>>      <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>>> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource
>>>>>>>>>>>>>>>>>>> (on Karaf
>>>>>>>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> If you install an unique provider (only derby or
>>>>>>>>>>>>>>>>>>> derbyclient,
>>>>>>>>>>>>>>      but not
>>>>>>>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> then:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>>>>>>>      jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>>>>>>>                    │ URL
>>>>>>>>>>>>>>>>>>>                                │ Status
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>      ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 -
>>>>>>>>>>>>>>>>>>> (1828579) │
>>>>>>>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in
>>>>>>>>>>>>>>>>>>> cause, like it
>>>>>>>>>>>>>>>>>>> bootstrap two db.  How to do you provision the
>>>>>>>>>>>>>>>>>>> datasource cfg
>>>>>>>>>>>>>>      file ?
>>>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc
>>>>>>>>>>>>>>>>>>> folder ?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I am experiencing a problem
>>>>>>>>>>>>>>>>>>>> where /pax-jdbc-config/ (version
>>>>>>>>>>>>>>      1.3.0) is
>>>>>>>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the
>>>>>>>>>>>>>>>>>>>> data source
>>>>>>>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory,
>>>>>>>>>>>>>>>>>>>> after a while I
>>>>>>>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> The configuration
>>>>>>>>>>>>>>>>>>>> file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>      dataSourceName=querier
>>>>>>>>>>>>>>>>>>>>      url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      user=enquery
>>>>>>>>>>>>>>>>>>>>      password=XXXX
>>>>>>>>>>>>>>>>>>>>      databaseName=querier
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      ops4j.preHook=querierDB
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      karaf@root()> service:list DataSource
>>>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>>>                                                              
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>>>                                                              
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>>>                         [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>>>      ----------------------
>>>>>>>>>>>>>>>>>>>>       databaseName = querier
>>>>>>>>>>>>>>>>>>>>       dataSourceName = querier
>>>>>>>>>>>>>>>>>>>>       felix.fileinstall.filename =
>>>>>>>>>>>>>>>>>>>>      file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>       ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>>>       osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>       osgi.jndi.service.name
>>>>>>>>>>>>>>>>>>>> <http://osgi.jndi.service.name> =
>>>>>>>>>>>>>>      querier
>>>>>>>>>>>>>>>>>>>>       password = enquery
>>>>>>>>>>>>>>>>>>>>       pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>>>       service.bundleid = 169
>>>>>>>>>>>>>>>>>>>>       service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>>>       service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>>>>>>>       service.pid =
>>>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>       service.scope = singleton
>>>>>>>>>>>>>>>>>>>>       url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>       user = enquery
>>>>>>>>>>>>>>>>>>>>      Provided by :
>>>>>>>>>>>>>>>>>>>>       OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>>>      Used by:
>>>>>>>>>>>>>>>>>>>>       JPA (22)
>>>>>>>>>>>>>>>>>>>>      [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>>>      ----------------------
>>>>>>>>>>>>>>>>>>>>       databaseName = querier
>>>>>>>>>>>>>>>>>>>>       dataSourceName = querier
>>>>>>>>>>>>>>>>>>>>       felix.fileinstall.filename
>>>>>>>>>>>>>>>>>>>>      = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>       ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>>>       osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>>       osgi.jndi.service.name
>>>>>>>>>>>>>>>>>>>> <http://osgi.jndi.service.name> =
>>>>>>>>>>>>>>      querier
>>>>>>>>>>>>>>>>>>>>       password = enquery
>>>>>>>>>>>>>>>>>>>>       pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>>>       service.bundleid = 169
>>>>>>>>>>>>>>>>>>>>       service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>>>       service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>>>>>>>       service.pid =
>>>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>       service.scope = singleton
>>>>>>>>>>>>>>>>>>>>       url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>>       user = enquery
>>>>>>>>>>>>>>>>>>>>      Provided by :
>>>>>>>>>>>>>>>>>>>>       OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>>>>      Name    │ Product      │ Version               │
>>>>>>>>>>>>>>>>>>>> URL
>>>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>>>                │ Status
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>         ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>      querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>>>      jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>>      querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>>>      jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> I think it must be specific to Derby, as the same
>>>>>>>>>>>>>>>>>>>> works fine
>>>>>>>>>>>>>>      if the
>>>>>>>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>>>      <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>>>      <ma...@apache.org>>
>>>>>>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>      <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>>>>>>>      --
>>>>>>>>>>>>>>      Jean-Baptiste Onofré
>>>>>>>>>>>>>>      jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>      http://blog.nanthrax.net
>>>>>>>>>>>>>>      Talend - http://www.talend.com
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>> Christian Schneider
>>>>>>>>>>>>>> http://www.liquid-reality.de
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Computer Scientist
>>>>>>>>>>>>>> http://www.adobe.com
>>>>>>>>>>>>>>
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Benjamin Graf <be...@gmx.net>.
Hi,

I'm a little bit confused:

<feature name="pax-jdbc-spec" description="Provides OSGi JDBC Service
spec" version="${project.version}">
        <bundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
</feature>

<feature name="pax-jdbc-derby" description="Provides JDBC Derby Embedded
DataSourceFactory" version="${project.version}">
        <feature>pax-jdbc-spec</feature>

        <bundle>mvn:org.apache.derby/derby/${derby.version}</bundle>
</feature>

pax-jdbc-derby still does install
mvn:org.osgi/org.osgi.service.jdbc/x.x.x but not
mvn:org.ops4j.pax.jdbc/pax-jdbc/x.x.x

Regards

Benjamin

Am 04.02.2019 um 21:29 schrieb Jean-Baptiste Onofré:
> Hi,
>
> Actually, this is because pax-jdbc-spec feature should have:
>
> <bundle
> dependency="true">mvn:org.osgi/org.osgi.service.jdbc/${org.osgi.service.jdbc.version}</bundle>
>
> That's why jdbc feature make things working.
>
> If you don't mind, I would like to release Karaf 4.2.3 like this (as
> it works fine). In the mean time, I'm creating a Jira at Pax JDBC to
> add the org.osgi.service.jdbc bundle in pax-jdbc-derby feature.
>
> OK ?
>
> Regards
> JB
>
> On 04/02/2019 21:24, Benjamin Graf wrote:
>> Hi JB,
>>
>> I would suggest to add pax-jdbc feature as dependency to pax-jdbc-derby
>> feature as it would work without. Just keep pax features independent
>> from possible installed karaf feature.
>>
>> What do you think?
>>
>> Regards
>>
>> Benjamin
>>
>> Am 04.02.2019 um 21:20 schrieb Jean-Baptiste Onofré:
>>> Hi Benjamin,
>>>
>>> Previously, pax-jdbc-derby feature also needed pax-jdbc feature.
>>>
>>> I directly installed the derby bundle, it uses dynamic import, that's
>>> why it works with pax-jdbc-spec IMHO (with the package with
>>> DataSourceFactory is there).
>>>
>>> So, I'm not sure to see your point: in previous version, you also need
>>> pax-jdbc to get the adapter working.
>>>
>>> What are you suggesting ?
>>>
>>> Regards
>>> JB
>>>
>>> On 04/02/2019 21:08, Benjamin Graf wrote:
>>>> Hu JB,
>>>>
>>>> Just to summarize:
>>>>
>>>> Karaf jdbc installs pax-jdbc and pax-jdbc-config sub features.
>>>> pax-jdbc
>>>> is needed to get a DataSourceFactory instance for Driver only
>>>> installations like Derby. Derby does not register a DataSourceFactory
>>>> directly. But if you do not install jdbc and/or pax-jdbc you won't get
>>>> the DataSourceFactory for Derby anymore. That IMHO is a break to
>>>> previous versions using the pax-jdbc-derby adaptor.
>>>>
>>>> Regards
>>>>
>>>> Benjamin
>>>>
>>>> Am 04.02.2019 um 21:03 schrieb Jean-Baptiste Onofré:
>>>>> pax-jdbc installs the pax-jdbc-spec bundle, that's why.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> On 04/02/2019 20:59, Benjamin Graf wrote:
>>>>>> This way pax-jdbc-derby also need pax-jdbc feature to get installed!
>>>>>>
>>>>>> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>>>>>>> Hi JB,
>>>>>>>
>>>>>>> I install pax-jdbc-config and pax-jdbc-derby. After installing
>>>>>>> pax-jdbc
>>>>>>> I got the derby DataSourceFactory. IMHO pax-jdbc is not
>>>>>>> mandatory to
>>>>>>> install and pooling seems to not work either.
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Benjamin
>>>>>>>
>>>>>>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>>>>>>> By the way, Karaf example itest (jdbc example) use Derby
>>>>>>>> without problem.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>>>>>>> Hi JB,
>>>>>>>>>
>>>>>>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I
>>>>>>>>> do not get
>>>>>>>>> a DataSourceFactory registered. I also do not found any code
>>>>>>>>> in derby
>>>>>>>>> sources that does anything about that if do not install
>>>>>>>>> pax-jdbc  to get
>>>>>>>>> the Driver instrumented.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>>
>>>>>>>>> Benjamin
>>>>>>>>>
>>>>>>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>>>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf
>>>>>>>>>> 4.2.3-SNAPSHOT is
>>>>>>>>>> already updated. So it will be included in 4.2.3 release that
>>>>>>>>>> will be on
>>>>>>>>>> vote tonight.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>>>>>>> Thank you all,
>>>>>>>>>>>
>>>>>>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby
>>>>>>>>>>> / and
>>>>>>>>>>> adding only the derby feature.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>> Alex soto
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré
>>>>>>>>>>>> <jb@nanthrax.net
>>>>>>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby
>>>>>>>>>>>> feature but just
>>>>>>>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>>>>>>>
>>>>>>>>>>>> Regards
>>>>>>>>>>>> JB
>>>>>>>>>>>>
>>>>>>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>>>>>>> If derby now provides a DataSourceFactory then we should
>>>>>>>>>>>>> remove
>>>>>>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I guess at some point derby started providing the DSF and
>>>>>>>>>>>>> we just forgot
>>>>>>>>>>>>> to remove the adapter bundle.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Christian
>>>>>>>>>>>>>
>>>>>>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste
>>>>>>>>>>>>> Onofré
>>>>>>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>> <ma...@nanthrax.net>>:
>>>>>>>>>>>>>
>>>>>>>>>>>>>     By the way, a simple workaround is to stop or even
>>>>>>>>>>>>> remove the
>>>>>>>>>>>>>     pax-jdbc-derby bundle, and use only the derby bundle
>>>>>>>>>>>>> (or the
>>>>>>>>>>>>> opposite).
>>>>>>>>>>>>>
>>>>>>>>>>>>>     Regards
>>>>>>>>>>>>>     JB
>>>>>>>>>>>>>
>>>>>>>>>>>>>     On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>>>>>>> OK, I think I found the problem: installing the
>>>>>>>>>>>>>> pax-jdbc-derby feature
>>>>>>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby
>>>>>>>>>>>>>> bundle
>>>>>>>>>>>>>     (which
>>>>>>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby
>>>>>>>>>>>>>> bundle
>>>>>>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>>>>>>     <http://osgi.jdbc.driver.name> service property.
>>>>>>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>>>>>>     datasource per
>>>>>>>>>>>>>> factory.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> That's why it's only when you use derby and actually, the
>>>>>>>>>>>>>> two
>>>>>>>>>>>>>     datasource
>>>>>>>>>>>>>> services come from the two factories.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I'm fixing that.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>>>>>>> Oh, thanks!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Can you suggest a work around?
>>>>>>>>>>>>>>> What s the ETA for a fix?
>>>>>>>>>>>>>>> I have a release deadline looming and I am afraid I
>>>>>>>>>>>>>>> can't wait
>>>>>>>>>>>>>     too long.
>>>>>>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>>     <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Name    │ Service Id │ Product      │ Version
>>>>>>>>>>>>>>>>               │ URL
>>>>>>>>>>>>>>>>                     │ Status
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>     ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 -
>>>>>>>>>>>>>>>> (1765088) │
>>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 -
>>>>>>>>>>>>>>>> (1765088) │
>>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I will fix that.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc
>>>>>>>>>>>>>>>>>> folder ?
>>>>>>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>>     <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>>>>>>>> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>>
>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource
>>>>>>>>>>>>>>>>>> (on Karaf
>>>>>>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> If you install an unique provider (only derby or
>>>>>>>>>>>>>>>>>> derbyclient,
>>>>>>>>>>>>>     but not
>>>>>>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> then:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>>>>>>     jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>>>>>>                   │ URL
>>>>>>>>>>>>>>>>>>                               │ Status
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>     ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 -
>>>>>>>>>>>>>>>>>> (1828579) │
>>>>>>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in
>>>>>>>>>>>>>>>>>> cause, like it
>>>>>>>>>>>>>>>>>> bootstrap two db.  How to do you provision the
>>>>>>>>>>>>>>>>>> datasource cfg
>>>>>>>>>>>>>     file ?
>>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc
>>>>>>>>>>>>>>>>>> folder ?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I am experiencing a problem
>>>>>>>>>>>>>>>>>>> where /pax-jdbc-config/ (version
>>>>>>>>>>>>>     1.3.0) is
>>>>>>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the
>>>>>>>>>>>>>>>>>>> data source
>>>>>>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory,
>>>>>>>>>>>>>>>>>>> after a while I
>>>>>>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> The configuration
>>>>>>>>>>>>>>>>>>> file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>     dataSourceName=querier
>>>>>>>>>>>>>>>>>>>     url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     user=enquery
>>>>>>>>>>>>>>>>>>>     password=XXXX
>>>>>>>>>>>>>>>>>>>     databaseName=querier
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     ops4j.preHook=querierDB
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     karaf@root()> service:list DataSource
>>>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>>>                                                             
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>>>                                                             
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>>>                        [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>>     ----------------------
>>>>>>>>>>>>>>>>>>>      databaseName = querier
>>>>>>>>>>>>>>>>>>>      dataSourceName = querier
>>>>>>>>>>>>>>>>>>>      felix.fileinstall.filename =
>>>>>>>>>>>>>>>>>>>     file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>      ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>>      osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>      osgi.jndi.service.name
>>>>>>>>>>>>>>>>>>> <http://osgi.jndi.service.name> =
>>>>>>>>>>>>>     querier
>>>>>>>>>>>>>>>>>>>      password = enquery
>>>>>>>>>>>>>>>>>>>      pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>>      service.bundleid = 169
>>>>>>>>>>>>>>>>>>>      service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>>      service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>>>>>>      service.pid =
>>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>      service.scope = singleton
>>>>>>>>>>>>>>>>>>>      url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>      user = enquery
>>>>>>>>>>>>>>>>>>>     Provided by :
>>>>>>>>>>>>>>>>>>>      OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>>     Used by:
>>>>>>>>>>>>>>>>>>>      JPA (22)
>>>>>>>>>>>>>>>>>>>     [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>>     ----------------------
>>>>>>>>>>>>>>>>>>>      databaseName = querier
>>>>>>>>>>>>>>>>>>>      dataSourceName = querier
>>>>>>>>>>>>>>>>>>>      felix.fileinstall.filename
>>>>>>>>>>>>>>>>>>>     = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>      ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>>      osgi.jdbc.driver.name
>>>>>>>>>>>>>>>>>>> <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>>      osgi.jndi.service.name
>>>>>>>>>>>>>>>>>>> <http://osgi.jndi.service.name> =
>>>>>>>>>>>>>     querier
>>>>>>>>>>>>>>>>>>>      password = enquery
>>>>>>>>>>>>>>>>>>>      pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>>      service.bundleid = 169
>>>>>>>>>>>>>>>>>>>      service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>>      service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>>>>>>      service.pid =
>>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>      service.scope = singleton
>>>>>>>>>>>>>>>>>>>      url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>>      user = enquery
>>>>>>>>>>>>>>>>>>>     Provided by :
>>>>>>>>>>>>>>>>>>>      OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>>>     Name    │ Product      │ Version               │
>>>>>>>>>>>>>>>>>>> URL
>>>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>>>               │ Status
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>        ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>     querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>>     jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>     querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>>     jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> I think it must be specific to Derby, as the same
>>>>>>>>>>>>>>>>>>> works fine
>>>>>>>>>>>>>     if the
>>>>>>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>>     <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>>     <ma...@apache.org>>
>>>>>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>     <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>>>>>>     --
>>>>>>>>>>>>>     Jean-Baptiste Onofré
>>>>>>>>>>>>>     jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>     http://blog.nanthrax.net
>>>>>>>>>>>>>     Talend - http://www.talend.com
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>> Christian Schneider
>>>>>>>>>>>>> http://www.liquid-reality.de
>>>>>>>>>>>>>
>>>>>>>>>>>>> Computer Scientist
>>>>>>>>>>>>> http://www.adobe.com
>>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

Actually, this is because pax-jdbc-spec feature should have:

<bundle 
dependency="true">mvn:org.osgi/org.osgi.service.jdbc/${org.osgi.service.jdbc.version}</bundle>

That's why jdbc feature make things working.

If you don't mind, I would like to release Karaf 4.2.3 like this (as it 
works fine). In the mean time, I'm creating a Jira at Pax JDBC to add 
the org.osgi.service.jdbc bundle in pax-jdbc-derby feature.

OK ?

Regards
JB

On 04/02/2019 21:24, Benjamin Graf wrote:
> Hi JB,
> 
> I would suggest to add pax-jdbc feature as dependency to pax-jdbc-derby
> feature as it would work without. Just keep pax features independent
> from possible installed karaf feature.
> 
> What do you think?
> 
> Regards
> 
> Benjamin
> 
> Am 04.02.2019 um 21:20 schrieb Jean-Baptiste Onofré:
>> Hi Benjamin,
>>
>> Previously, pax-jdbc-derby feature also needed pax-jdbc feature.
>>
>> I directly installed the derby bundle, it uses dynamic import, that's
>> why it works with pax-jdbc-spec IMHO (with the package with
>> DataSourceFactory is there).
>>
>> So, I'm not sure to see your point: in previous version, you also need
>> pax-jdbc to get the adapter working.
>>
>> What are you suggesting ?
>>
>> Regards
>> JB
>>
>> On 04/02/2019 21:08, Benjamin Graf wrote:
>>> Hu JB,
>>>
>>> Just to summarize:
>>>
>>> Karaf jdbc installs pax-jdbc and pax-jdbc-config sub features. pax-jdbc
>>> is needed to get a DataSourceFactory instance for Driver only
>>> installations like Derby. Derby does not register a DataSourceFactory
>>> directly. But if you do not install jdbc and/or pax-jdbc you won't get
>>> the DataSourceFactory for Derby anymore. That IMHO is a break to
>>> previous versions using the pax-jdbc-derby adaptor.
>>>
>>> Regards
>>>
>>> Benjamin
>>>
>>> Am 04.02.2019 um 21:03 schrieb Jean-Baptiste Onofré:
>>>> pax-jdbc installs the pax-jdbc-spec bundle, that's why.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 04/02/2019 20:59, Benjamin Graf wrote:
>>>>> This way pax-jdbc-derby also need pax-jdbc feature to get installed!
>>>>>
>>>>> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>>>>>> Hi JB,
>>>>>>
>>>>>> I install pax-jdbc-config and pax-jdbc-derby. After installing pax-jdbc
>>>>>> I got the derby DataSourceFactory. IMHO pax-jdbc is not mandatory to
>>>>>> install and pooling seems to not work either.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Benjamin
>>>>>>
>>>>>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>>>>>> By the way, Karaf example itest (jdbc example) use Derby without problem.
>>>>>>>
>>>>>>> Regards
>>>>>>> JB
>>>>>>>
>>>>>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>>>>>> Hi JB,
>>>>>>>>
>>>>>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
>>>>>>>> a DataSourceFactory registered. I also do not found any code in derby
>>>>>>>> sources that does anything about that if do not install pax-jdbc  to get
>>>>>>>> the Driver instrumented.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>>
>>>>>>>> Benjamin
>>>>>>>>
>>>>>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>>>>>>>>> already updated. So it will be included in 4.2.3 release that will be on
>>>>>>>>> vote tonight.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> JB
>>>>>>>>>
>>>>>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>>>>>> Thank you all,
>>>>>>>>>>
>>>>>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>>>>>>>>> adding only the derby feature.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Best regards,
>>>>>>>>>> Alex soto
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>>>>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>>>>>>
>>>>>>>>>>> Regards
>>>>>>>>>>> JB
>>>>>>>>>>>
>>>>>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>>>>>
>>>>>>>>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>>>>>>>>> to remove the adapter bundle.
>>>>>>>>>>>>
>>>>>>>>>>>> Christian
>>>>>>>>>>>>
>>>>>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>>>>>>>>
>>>>>>>>>>>>     By the way, a simple workaround is to stop or even remove the
>>>>>>>>>>>>     pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>>>>>>>>> opposite).
>>>>>>>>>>>>
>>>>>>>>>>>>     Regards
>>>>>>>>>>>>     JB
>>>>>>>>>>>>
>>>>>>>>>>>>     On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>>>>>>>>     (which
>>>>>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>>>>>
>>>>>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>>>>>     <http://osgi.jdbc.driver.name> service property.
>>>>>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>>>>>     datasource per
>>>>>>>>>>>>> factory.
>>>>>>>>>>>>>
>>>>>>>>>>>>> That's why it's only when you use derby and actually, the two
>>>>>>>>>>>>     datasource
>>>>>>>>>>>>> services come from the two factories.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I'm fixing that.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards
>>>>>>>>>>>>> JB
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>>>>>> Oh, thanks!
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Can you suggest a work around?
>>>>>>>>>>>>>> What s the ETA for a fix?
>>>>>>>>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>>>>>>>>     too long.
>>>>>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>     <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>>>>>>>>                     │ Status
>>>>>>>>>>>>>>>
>>>>>>>>>>>>     ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I will fix that.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>>>>>     <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>>>>>>>>     but not
>>>>>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> then:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>>>>>     jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>>>>>                   │ URL
>>>>>>>>>>>>>>>>>                               │ Status
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>     ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>>>>>>>>     file ?
>>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>>>>>>>>     1.3.0) is
>>>>>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>     dataSourceName=querier
>>>>>>>>>>>>>>>>>>     url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     user=enquery
>>>>>>>>>>>>>>>>>>     password=XXXX
>>>>>>>>>>>>>>>>>>     databaseName=querier
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     ops4j.preHook=querierDB
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     karaf@root()> service:list DataSource
>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>                                                              
>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>                                                              
>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>                    
>>>>>>>>>>>>>>>>>>     [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>     ----------------------
>>>>>>>>>>>>>>>>>>      databaseName = querier
>>>>>>>>>>>>>>>>>>      dataSourceName = querier
>>>>>>>>>>>>>>>>>>      felix.fileinstall.filename =
>>>>>>>>>>>>>>>>>>     file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>      ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>      osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>      osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>>>>>     querier
>>>>>>>>>>>>>>>>>>      password = enquery
>>>>>>>>>>>>>>>>>>      pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>      service.bundleid = 169
>>>>>>>>>>>>>>>>>>      service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>      service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>>>>>      service.pid =
>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>      service.scope = singleton
>>>>>>>>>>>>>>>>>>      url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>      user = enquery
>>>>>>>>>>>>>>>>>>     Provided by :
>>>>>>>>>>>>>>>>>>      OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>     Used by:
>>>>>>>>>>>>>>>>>>      JPA (22)
>>>>>>>>>>>>>>>>>>     [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>>     ----------------------
>>>>>>>>>>>>>>>>>>      databaseName = querier
>>>>>>>>>>>>>>>>>>      dataSourceName = querier
>>>>>>>>>>>>>>>>>>      felix.fileinstall.filename
>>>>>>>>>>>>>>>>>>     = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>>      ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>>      osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>>      osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>>>>>     querier
>>>>>>>>>>>>>>>>>>      password = enquery
>>>>>>>>>>>>>>>>>>      pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>>      service.bundleid = 169
>>>>>>>>>>>>>>>>>>      service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>>      service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>>>>>      service.pid =
>>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>>      service.scope = singleton
>>>>>>>>>>>>>>>>>>      url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>>      user = enquery
>>>>>>>>>>>>>>>>>>     Provided by :
>>>>>>>>>>>>>>>>>>      OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>     karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>>     Name    │ Product      │ Version               │ URL
>>>>>>>>>>>>              
>>>>>>>>>>>>>>>>>>               │ Status
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>        ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>>>>>     querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>     jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>     querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>>     jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>>>>>>>>     if the
>>>>>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>     <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>>>>>     <ma...@apache.org>>
>>>>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>     <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>>>>>     --
>>>>>>>>>>>>     Jean-Baptiste Onofré
>>>>>>>>>>>>     jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>     http://blog.nanthrax.net
>>>>>>>>>>>>     Talend - http://www.talend.com
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> -- 
>>>>>>>>>>>> Christian Schneider
>>>>>>>>>>>> http://www.liquid-reality.de
>>>>>>>>>>>>
>>>>>>>>>>>> Computer Scientist
>>>>>>>>>>>> http://www.adobe.com
>>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Benjamin Graf <be...@gmx.net>.
Hi JB,

I would suggest to add pax-jdbc feature as dependency to pax-jdbc-derby
feature as it would work without. Just keep pax features independent
from possible installed karaf feature.

What do you think?

Regards

Benjamin

Am 04.02.2019 um 21:20 schrieb Jean-Baptiste Onofré:
> Hi Benjamin,
>
> Previously, pax-jdbc-derby feature also needed pax-jdbc feature.
>
> I directly installed the derby bundle, it uses dynamic import, that's
> why it works with pax-jdbc-spec IMHO (with the package with
> DataSourceFactory is there).
>
> So, I'm not sure to see your point: in previous version, you also need
> pax-jdbc to get the adapter working.
>
> What are you suggesting ?
>
> Regards
> JB
>
> On 04/02/2019 21:08, Benjamin Graf wrote:
>> Hu JB,
>>
>> Just to summarize:
>>
>> Karaf jdbc installs pax-jdbc and pax-jdbc-config sub features. pax-jdbc
>> is needed to get a DataSourceFactory instance for Driver only
>> installations like Derby. Derby does not register a DataSourceFactory 
>> directly. But if you do not install jdbc and/or pax-jdbc you won't get
>> the DataSourceFactory for Derby anymore. That IMHO is a break to
>> previous versions using the pax-jdbc-derby adaptor.
>>
>> Regards
>>
>> Benjamin
>>
>> Am 04.02.2019 um 21:03 schrieb Jean-Baptiste Onofré:
>>> pax-jdbc installs the pax-jdbc-spec bundle, that's why.
>>>
>>> Regards
>>> JB
>>>
>>> On 04/02/2019 20:59, Benjamin Graf wrote:
>>>> This way pax-jdbc-derby also need pax-jdbc feature to get installed!
>>>>
>>>> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>>>>> Hi JB,
>>>>>
>>>>> I install pax-jdbc-config and pax-jdbc-derby. After installing pax-jdbc
>>>>> I got the derby DataSourceFactory. IMHO pax-jdbc is not mandatory to
>>>>> install and pooling seems to not work either.
>>>>>
>>>>> Regards
>>>>>
>>>>> Benjamin
>>>>>
>>>>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>>>>> By the way, Karaf example itest (jdbc example) use Derby without problem.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>>>>> Hi JB,
>>>>>>>
>>>>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
>>>>>>> a DataSourceFactory registered. I also do not found any code in derby
>>>>>>> sources that does anything about that if do not install pax-jdbc  to get
>>>>>>> the Driver instrumented.
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> Benjamin
>>>>>>>
>>>>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>>>>>>>> already updated. So it will be included in 4.2.3 release that will be on
>>>>>>>> vote tonight.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>>>>> Thank you all,
>>>>>>>>>
>>>>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>>>>>>>> adding only the derby feature.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Alex soto
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>>>>
>>>>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>>>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>>>>
>>>>>>>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>>>>>>>> to remove the adapter bundle.
>>>>>>>>>>>
>>>>>>>>>>> Christian
>>>>>>>>>>>
>>>>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>>>>>>>
>>>>>>>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>>>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>>>>>>>> opposite).
>>>>>>>>>>>
>>>>>>>>>>>    Regards
>>>>>>>>>>>    JB
>>>>>>>>>>>
>>>>>>>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>>>>
>>>>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>>>>>>>    (which
>>>>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>>>>
>>>>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>>>>    datasource per
>>>>>>>>>>>> factory.
>>>>>>>>>>>>
>>>>>>>>>>>> That's why it's only when you use derby and actually, the two
>>>>>>>>>>>    datasource
>>>>>>>>>>>> services come from the two factories.
>>>>>>>>>>>>
>>>>>>>>>>>> I'm fixing that.
>>>>>>>>>>>>
>>>>>>>>>>>> Regards
>>>>>>>>>>>> JB
>>>>>>>>>>>>
>>>>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>>>>> Oh, thanks!
>>>>>>>>>>>>>
>>>>>>>>>>>>> Can you suggest a work around? 
>>>>>>>>>>>>> What s the ETA for a fix? 
>>>>>>>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>>>>>>>    too long.  
>>>>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>>>>>>>                    │ Status
>>>>>>>>>>>>>>
>>>>>>>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I will fix that.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>>>>>>>    but not
>>>>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> then:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>>>>                  │ URL
>>>>>>>>>>>>>>>>                              │ Status
>>>>>>>>>>>>>>>>
>>>>>>>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>>>>>>>    file ?
>>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>>>>>>>    1.3.0) is
>>>>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    user=enquery
>>>>>>>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>                                                             
>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>                                                             
>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>                   
>>>>>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>>>>    querier
>>>>>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>    Used by: 
>>>>>>>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>>>>    querier
>>>>>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>>>>>>>             
>>>>>>>>>>>>>>>>>              │ Status
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>>>>>>>    if the
>>>>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>>>>    <ma...@apache.org>>
>>>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>>>>    --
>>>>>>>>>>>    Jean-Baptiste Onofré
>>>>>>>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>    http://blog.nanthrax.net
>>>>>>>>>>>    Talend - http://www.talend.com
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>>> -- 
>>>>>>>>>>> Christian Schneider
>>>>>>>>>>> http://www.liquid-reality.de
>>>>>>>>>>>
>>>>>>>>>>> Computer Scientist
>>>>>>>>>>> http://www.adobe.com
>>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Benjamin,

Previously, pax-jdbc-derby feature also needed pax-jdbc feature.

I directly installed the derby bundle, it uses dynamic import, that's
why it works with pax-jdbc-spec IMHO (with the package with
DataSourceFactory is there).

So, I'm not sure to see your point: in previous version, you also need
pax-jdbc to get the adapter working.

What are you suggesting ?

Regards
JB

On 04/02/2019 21:08, Benjamin Graf wrote:
> Hu JB,
> 
> Just to summarize:
> 
> Karaf jdbc installs pax-jdbc and pax-jdbc-config sub features. pax-jdbc
> is needed to get a DataSourceFactory instance for Driver only
> installations like Derby. Derby does not register a DataSourceFactory 
> directly. But if you do not install jdbc and/or pax-jdbc you won't get
> the DataSourceFactory for Derby anymore. That IMHO is a break to
> previous versions using the pax-jdbc-derby adaptor.
> 
> Regards
> 
> Benjamin
> 
> Am 04.02.2019 um 21:03 schrieb Jean-Baptiste Onofré:
>> pax-jdbc installs the pax-jdbc-spec bundle, that's why.
>>
>> Regards
>> JB
>>
>> On 04/02/2019 20:59, Benjamin Graf wrote:
>>> This way pax-jdbc-derby also need pax-jdbc feature to get installed!
>>>
>>> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>>>> Hi JB,
>>>>
>>>> I install pax-jdbc-config and pax-jdbc-derby. After installing pax-jdbc
>>>> I got the derby DataSourceFactory. IMHO pax-jdbc is not mandatory to
>>>> install and pooling seems to not work either.
>>>>
>>>> Regards
>>>>
>>>> Benjamin
>>>>
>>>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>>>> By the way, Karaf example itest (jdbc example) use Derby without problem.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>>>> Hi JB,
>>>>>>
>>>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
>>>>>> a DataSourceFactory registered. I also do not found any code in derby
>>>>>> sources that does anything about that if do not install pax-jdbc  to get
>>>>>> the Driver instrumented.
>>>>>>
>>>>>> Regards
>>>>>>
>>>>>> Benjamin
>>>>>>
>>>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>>>>>>> already updated. So it will be included in 4.2.3 release that will be on
>>>>>>> vote tonight.
>>>>>>>
>>>>>>> Regards
>>>>>>> JB
>>>>>>>
>>>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>>>> Thank you all,
>>>>>>>>
>>>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>>>>>>> adding only the derby feature.
>>>>>>>>
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Alex soto
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>>>
>>>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> JB
>>>>>>>>>
>>>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>>>
>>>>>>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>>>>>>> to remove the adapter bundle.
>>>>>>>>>>
>>>>>>>>>> Christian
>>>>>>>>>>
>>>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>>>>>>
>>>>>>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>>>>>>> opposite).
>>>>>>>>>>
>>>>>>>>>>    Regards
>>>>>>>>>>    JB
>>>>>>>>>>
>>>>>>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>>>
>>>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>>>>>>    (which
>>>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>>>
>>>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>>>    datasource per
>>>>>>>>>>> factory.
>>>>>>>>>>>
>>>>>>>>>>> That's why it's only when you use derby and actually, the two
>>>>>>>>>>    datasource
>>>>>>>>>>> services come from the two factories.
>>>>>>>>>>>
>>>>>>>>>>> I'm fixing that.
>>>>>>>>>>>
>>>>>>>>>>> Regards
>>>>>>>>>>> JB
>>>>>>>>>>>
>>>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>>>> Oh, thanks!
>>>>>>>>>>>>
>>>>>>>>>>>> Can you suggest a work around? 
>>>>>>>>>>>> What s the ETA for a fix? 
>>>>>>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>>>>>>    too long.  
>>>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>>>
>>>>>>>>>>>> Best regards,
>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>>>>>>                    │ Status
>>>>>>>>>>>>>
>>>>>>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>
>>>>>>>>>>>>> I will fix that.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards
>>>>>>>>>>>>> JB
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>>>>>>    but not
>>>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> then:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>>>                  │ URL
>>>>>>>>>>>>>>>                              │ Status
>>>>>>>>>>>>>>>
>>>>>>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>>>>>>    file ?
>>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>>>>>>    1.3.0) is
>>>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    user=enquery
>>>>>>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>>>>>>             
>>>>>>>>>>>>>>>>                                                             
>>>>>>>>>>             
>>>>>>>>>>>>>>>>                                                             
>>>>>>>>>>             
>>>>>>>>>>>>>>>>                   
>>>>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>>>    querier
>>>>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>    Used by: 
>>>>>>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>>>    querier
>>>>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>>>>>>             
>>>>>>>>>>>>>>>>              │ Status
>>>>>>>>>>>>>>>>
>>>>>>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>>>>>>    if the
>>>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>>>    <ma...@apache.org>>
>>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>>>    --
>>>>>>>>>>    Jean-Baptiste Onofré
>>>>>>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>    http://blog.nanthrax.net
>>>>>>>>>>    Talend - http://www.talend.com
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> -- 
>>>>>>>>>> Christian Schneider
>>>>>>>>>> http://www.liquid-reality.de
>>>>>>>>>>
>>>>>>>>>> Computer Scientist
>>>>>>>>>> http://www.adobe.com
>>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>> Talend - http://www.talend.com

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Benjamin Graf <be...@gmx.net>.
Hu JB,

Just to summarize:

Karaf jdbc installs pax-jdbc and pax-jdbc-config sub features. pax-jdbc
is needed to get a DataSourceFactory instance for Driver only
installations like Derby. Derby does not register a DataSourceFactory 
directly. But if you do not install jdbc and/or pax-jdbc you won't get
the DataSourceFactory for Derby anymore. That IMHO is a break to
previous versions using the pax-jdbc-derby adaptor.

Regards

Benjamin

Am 04.02.2019 um 21:03 schrieb Jean-Baptiste Onofré:
> pax-jdbc installs the pax-jdbc-spec bundle, that's why.
>
> Regards
> JB
>
> On 04/02/2019 20:59, Benjamin Graf wrote:
>> This way pax-jdbc-derby also need pax-jdbc feature to get installed!
>>
>> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>>> Hi JB,
>>>
>>> I install pax-jdbc-config and pax-jdbc-derby. After installing pax-jdbc
>>> I got the derby DataSourceFactory. IMHO pax-jdbc is not mandatory to
>>> install and pooling seems to not work either.
>>>
>>> Regards
>>>
>>> Benjamin
>>>
>>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>>> By the way, Karaf example itest (jdbc example) use Derby without problem.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>>> Hi JB,
>>>>>
>>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
>>>>> a DataSourceFactory registered. I also do not found any code in derby
>>>>> sources that does anything about that if do not install pax-jdbc  to get
>>>>> the Driver instrumented.
>>>>>
>>>>> Regards
>>>>>
>>>>> Benjamin
>>>>>
>>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>>>>>> already updated. So it will be included in 4.2.3 release that will be on
>>>>>> vote tonight.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>>> Thank you all,
>>>>>>>
>>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>>>>>> adding only the derby feature.
>>>>>>>
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Alex soto
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>>
>>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>>
>>>>>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>>>>>> to remove the adapter bundle.
>>>>>>>>>
>>>>>>>>> Christian
>>>>>>>>>
>>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>>>>>
>>>>>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>>>>>> opposite).
>>>>>>>>>
>>>>>>>>>    Regards
>>>>>>>>>    JB
>>>>>>>>>
>>>>>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>>
>>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>>>>>    (which
>>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>>
>>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>>    datasource per
>>>>>>>>>> factory.
>>>>>>>>>>
>>>>>>>>>> That's why it's only when you use derby and actually, the two
>>>>>>>>>    datasource
>>>>>>>>>> services come from the two factories.
>>>>>>>>>>
>>>>>>>>>> I'm fixing that.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>>> Oh, thanks!
>>>>>>>>>>>
>>>>>>>>>>> Can you suggest a work around? 
>>>>>>>>>>> What s the ETA for a fix? 
>>>>>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>>>>>    too long.  
>>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>> Alex soto
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>>
>>>>>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>>>>>                    │ Status
>>>>>>>>>>>>
>>>>>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>
>>>>>>>>>>>> I will fix that.
>>>>>>>>>>>>
>>>>>>>>>>>> Regards
>>>>>>>>>>>> JB
>>>>>>>>>>>>
>>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>>
>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>>>>>    but not
>>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> then:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>>                  │ URL
>>>>>>>>>>>>>>                              │ Status
>>>>>>>>>>>>>>
>>>>>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>>>>>    file ?
>>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Regards
>>>>>>>>>>>>>> JB
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>>>>>    1.3.0) is
>>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    user=enquery
>>>>>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>>>>>             
>>>>>>>>>>>>>>>                                                             
>>>>>>>>>             
>>>>>>>>>>>>>>>                                                             
>>>>>>>>>             
>>>>>>>>>>>>>>>                   
>>>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>>    querier
>>>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>    Used by: 
>>>>>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>>    querier
>>>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>>>>>             
>>>>>>>>>>>>>>>              │ Status
>>>>>>>>>>>>>>>
>>>>>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>>>>>    if the
>>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> -- 
>>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>>    <ma...@apache.org>>
>>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>>    --
>>>>>>>>>    Jean-Baptiste Onofré
>>>>>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>>>>>> <ma...@apache.org>
>>>>>>>>>    http://blog.nanthrax.net
>>>>>>>>>    Talend - http://www.talend.com
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>> -- 
>>>>>>>>> Christian Schneider
>>>>>>>>> http://www.liquid-reality.de
>>>>>>>>>
>>>>>>>>> Computer Scientist
>>>>>>>>> http://www.adobe.com
>>>>>>>>>
>>>>>>>> -- 
>>>>>>>> Jean-Baptiste Onofré
>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>> http://blog.nanthrax.net
>>>>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
pax-jdbc installs the pax-jdbc-spec bundle, that's why.

Regards
JB

On 04/02/2019 20:59, Benjamin Graf wrote:
> This way pax-jdbc-derby also need pax-jdbc feature to get installed!
> 
> Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
>> Hi JB,
>>
>> I install pax-jdbc-config and pax-jdbc-derby. After installing pax-jdbc
>> I got the derby DataSourceFactory. IMHO pax-jdbc is not mandatory to
>> install and pooling seems to not work either.
>>
>> Regards
>>
>> Benjamin
>>
>> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>>> By the way, Karaf example itest (jdbc example) use Derby without problem.
>>>
>>> Regards
>>> JB
>>>
>>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>>> Hi JB,
>>>>
>>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
>>>> a DataSourceFactory registered. I also do not found any code in derby
>>>> sources that does anything about that if do not install pax-jdbc  to get
>>>> the Driver instrumented.
>>>>
>>>> Regards
>>>>
>>>> Benjamin
>>>>
>>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>>>>> already updated. So it will be included in 4.2.3 release that will be on
>>>>> vote tonight.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>>> Thank you all,
>>>>>>
>>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>>>>> adding only the derby feature.
>>>>>>
>>>>>>
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>>
>>>>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>>
>>>>>>> Regards
>>>>>>> JB
>>>>>>>
>>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>>
>>>>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>>>>> to remove the adapter bundle.
>>>>>>>>
>>>>>>>> Christian
>>>>>>>>
>>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>>>>
>>>>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>>>>> opposite).
>>>>>>>>
>>>>>>>>    Regards
>>>>>>>>    JB
>>>>>>>>
>>>>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>>
>>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>>>>    (which
>>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>>
>>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>>    datasource per
>>>>>>>>> factory.
>>>>>>>>>
>>>>>>>>> That's why it's only when you use derby and actually, the two
>>>>>>>>    datasource
>>>>>>>>> services come from the two factories.
>>>>>>>>>
>>>>>>>>> I'm fixing that.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> JB
>>>>>>>>>
>>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>>> Oh, thanks!
>>>>>>>>>>
>>>>>>>>>> Can you suggest a work around? 
>>>>>>>>>> What s the ETA for a fix? 
>>>>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>>>>    too long.  
>>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>>
>>>>>>>>>> Best regards,
>>>>>>>>>> Alex soto
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>>
>>>>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>>>>                    │ Status
>>>>>>>>>>>
>>>>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>
>>>>>>>>>>> I will fix that.
>>>>>>>>>>>
>>>>>>>>>>> Regards
>>>>>>>>>>> JB
>>>>>>>>>>>
>>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>>
>>>>>>>>>>>> Best regards,
>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>>
>>>>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>>>>    but not
>>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I did:
>>>>>>>>>>>>>
>>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>>
>>>>>>>>>>>>> then:
>>>>>>>>>>>>>
>>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>>
>>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>>                  │ URL
>>>>>>>>>>>>>                              │ Status
>>>>>>>>>>>>>
>>>>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>>
>>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>>>>    file ?
>>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>>
>>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Regards
>>>>>>>>>>>>> JB
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>>>>    1.3.0) is
>>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>>>>> can see
>>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    user=enquery
>>>>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>>>>             
>>>>>>>>>>>>>>                                                             
>>>>>>>>             
>>>>>>>>>>>>>>                                                             
>>>>>>>>             
>>>>>>>>>>>>>>                   
>>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>    querier
>>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>    Used by: 
>>>>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>>    querier
>>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>>>>             
>>>>>>>>>>>>>>              │ Status
>>>>>>>>>>>>>>
>>>>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>>>>    if the
>>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>>    <ma...@apache.org>>
>>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>>> -- 
>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>>    --
>>>>>>>>    Jean-Baptiste Onofré
>>>>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>>>>> <ma...@apache.org>
>>>>>>>>    http://blog.nanthrax.net
>>>>>>>>    Talend - http://www.talend.com
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> -- 
>>>>>>>> Christian Schneider
>>>>>>>> http://www.liquid-reality.de
>>>>>>>>
>>>>>>>> Computer Scientist
>>>>>>>> http://www.adobe.com
>>>>>>>>
>>>>>>> -- 
>>>>>>> Jean-Baptiste Onofré
>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>> http://blog.nanthrax.net
>>>>>>> Talend - http://www.talend.com

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Benjamin Graf <be...@gmx.net>.
This way pax-jdbc-derby also need pax-jdbc feature to get installed!

Am 04.02.2019 um 20:57 schrieb Benjamin Graf:
> Hi JB,
>
> I install pax-jdbc-config and pax-jdbc-derby. After installing pax-jdbc
> I got the derby DataSourceFactory. IMHO pax-jdbc is not mandatory to
> install and pooling seems to not work either.
>
> Regards
>
> Benjamin
>
> Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
>> By the way, Karaf example itest (jdbc example) use Derby without problem.
>>
>> Regards
>> JB
>>
>> On 04/02/2019 20:23, Benjamin Graf wrote:
>>> Hi JB,
>>>
>>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
>>> a DataSourceFactory registered. I also do not found any code in derby
>>> sources that does anything about that if do not install pax-jdbc  to get
>>> the Driver instrumented.
>>>
>>> Regards
>>>
>>> Benjamin
>>>
>>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>>>> already updated. So it will be included in 4.2.3 release that will be on
>>>> vote tonight.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>>> Thank you all,
>>>>>
>>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>>>> adding only the derby feature.
>>>>>
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>>> <ma...@nanthrax.net>> wrote:
>>>>>>
>>>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>>>> pax-jdbc-derby from the feature.
>>>>>>>
>>>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>>>> to remove the adapter bundle.
>>>>>>>
>>>>>>> Christian
>>>>>>>
>>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>>>
>>>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>>>> opposite).
>>>>>>>
>>>>>>>    Regards
>>>>>>>    JB
>>>>>>>
>>>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>>
>>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>>>    (which
>>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>>
>>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>>    datasource per
>>>>>>>> factory.
>>>>>>>>
>>>>>>>> That's why it's only when you use derby and actually, the two
>>>>>>>    datasource
>>>>>>>> services come from the two factories.
>>>>>>>>
>>>>>>>> I'm fixing that.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>>> Oh, thanks!
>>>>>>>>>
>>>>>>>>> Can you suggest a work around? 
>>>>>>>>> What s the ETA for a fix? 
>>>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>>>    too long.  
>>>>>>>>> Thank you for the prompt response.
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Alex soto
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>>
>>>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>>>                    │ Status
>>>>>>>>>>
>>>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>
>>>>>>>>>> I will fix that.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>> Alex soto
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>>
>>>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>>>    but not
>>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>>
>>>>>>>>>>>> I did:
>>>>>>>>>>>>
>>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>>
>>>>>>>>>>>> then:
>>>>>>>>>>>>
>>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>>
>>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>>                  │ URL
>>>>>>>>>>>>                              │ Status
>>>>>>>>>>>>
>>>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>>
>>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>>>    file ?
>>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>>
>>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>>
>>>>>>>>>>>> Regards
>>>>>>>>>>>> JB
>>>>>>>>>>>>
>>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>>>    1.3.0) is
>>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>>>> can see
>>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>>
>>>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>>
>>>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>
>>>>>>>>>>>>>    user=enquery
>>>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>>>
>>>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>>>             
>>>>>>>>>>>>>                                                             
>>>>>>>             
>>>>>>>>>>>>>                                                             
>>>>>>>             
>>>>>>>>>>>>>                   
>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>    querier
>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>    Used by: 
>>>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>>    querier
>>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Also:
>>>>>>>>>>>>>
>>>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>>>             
>>>>>>>>>>>>>              │ Status
>>>>>>>>>>>>>
>>>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>>>    if the
>>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Best regards,
>>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>>    <ma...@apache.org>>
>>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>>> -- 
>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>> <ma...@apache.org>
>>>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>>    --
>>>>>>>    Jean-Baptiste Onofré
>>>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>>>> <ma...@apache.org>
>>>>>>>    http://blog.nanthrax.net
>>>>>>>    Talend - http://www.talend.com
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>>> -- 
>>>>>>> Christian Schneider
>>>>>>> http://www.liquid-reality.de
>>>>>>>
>>>>>>> Computer Scientist
>>>>>>> http://www.adobe.com
>>>>>>>
>>>>>> -- 
>>>>>> Jean-Baptiste Onofré
>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>> http://blog.nanthrax.net
>>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Benjamin Graf <be...@gmx.net>.
Hi JB,

I install pax-jdbc-config and pax-jdbc-derby. After installing pax-jdbc
I got the derby DataSourceFactory. IMHO pax-jdbc is not mandatory to
install and pooling seems to not work either.

Regards

Benjamin

Am 04.02.2019 um 20:44 schrieb Jean-Baptiste Onofré:
> By the way, Karaf example itest (jdbc example) use Derby without problem.
>
> Regards
> JB
>
> On 04/02/2019 20:23, Benjamin Graf wrote:
>> Hi JB,
>>
>> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
>> a DataSourceFactory registered. I also do not found any code in derby
>> sources that does anything about that if do not install pax-jdbc  to get
>> the Driver instrumented.
>>
>> Regards
>>
>> Benjamin
>>
>> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>>> already updated. So it will be included in 4.2.3 release that will be on
>>> vote tonight.
>>>
>>> Regards
>>> JB
>>>
>>> On 04/02/2019 16:27, Alex Soto wrote:
>>>> Thank you all,
>>>>
>>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>>> adding only the derby feature.
>>>>
>>>>
>>>> Best regards,
>>>> Alex soto
>>>>
>>>>
>>>>
>>>>
>>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>> <ma...@nanthrax.net>> wrote:
>>>>>
>>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>>> pax-jdbc-derby from the feature.
>>>>>>
>>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>>> to remove the adapter bundle.
>>>>>>
>>>>>> Christian
>>>>>>
>>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>>
>>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>>> opposite).
>>>>>>
>>>>>>    Regards
>>>>>>    JB
>>>>>>
>>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>>> actually registers two DataSourceFactory services:
>>>>>>>
>>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>>    (which
>>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>>
>>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>>    datasource per
>>>>>>> factory.
>>>>>>>
>>>>>>> That's why it's only when you use derby and actually, the two
>>>>>>    datasource
>>>>>>> services come from the two factories.
>>>>>>>
>>>>>>> I'm fixing that.
>>>>>>>
>>>>>>> Regards
>>>>>>> JB
>>>>>>>
>>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>>> Oh, thanks!
>>>>>>>>
>>>>>>>> Can you suggest a work around? 
>>>>>>>> What s the ETA for a fix? 
>>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>>    too long.  
>>>>>>>> Thank you for the prompt response.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Alex soto
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>
>>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>>
>>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>>                    │ Status
>>>>>>>>>
>>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>>
>>>>>>>>> I will fix that.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> JB
>>>>>>>>>
>>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>>
>>>>>>>>>> Best regards,
>>>>>>>>>> Alex soto
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>>
>>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>>    but not
>>>>>>>>>>> both), then, it should work.
>>>>>>>>>>>
>>>>>>>>>>> I did:
>>>>>>>>>>>
>>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>>
>>>>>>>>>>> then:
>>>>>>>>>>>
>>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>>
>>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>>                  │ URL
>>>>>>>>>>>                              │ Status
>>>>>>>>>>>
>>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>>
>>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>>    file ?
>>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>>
>>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>>
>>>>>>>>>>> Regards
>>>>>>>>>>> JB
>>>>>>>>>>>
>>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>>> Hello,
>>>>>>>>>>>>
>>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>>    1.3.0) is
>>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>>> can see
>>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>>
>>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>>
>>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>
>>>>>>>>>>>>    user=enquery
>>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>>
>>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>>
>>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>>             
>>>>>>>>>>>>                                                             
>>>>>>             
>>>>>>>>>>>>                                                             
>>>>>>             
>>>>>>>>>>>>                   
>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>    querier
>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>    Used by: 
>>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>>    ----------------------
>>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>>    querier
>>>>>>>>>>>>     password = enquery
>>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>>     service.pid =
>>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>>     user = enquery
>>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Also:
>>>>>>>>>>>>
>>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>>             
>>>>>>>>>>>>              │ Status
>>>>>>>>>>>>
>>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>>    if the
>>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>>> Any clues?
>>>>>>>>>>>>
>>>>>>>>>>>> Best regards,
>>>>>>>>>>>> Alex soto
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>>    <ma...@apache.org>>
>>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>>> -- 
>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>> <ma...@apache.org>
>>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>>    --
>>>>>>    Jean-Baptiste Onofré
>>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>>> <ma...@apache.org>
>>>>>>    http://blog.nanthrax.net
>>>>>>    Talend - http://www.talend.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> -- 
>>>>>> Christian Schneider
>>>>>> http://www.liquid-reality.de
>>>>>>
>>>>>> Computer Scientist
>>>>>> http://www.adobe.com
>>>>>>
>>>>> -- 
>>>>> Jean-Baptiste Onofré
>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>> http://blog.nanthrax.net
>>>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
By the way, Karaf example itest (jdbc example) use Derby without problem.

Regards
JB

On 04/02/2019 20:23, Benjamin Graf wrote:
> Hi JB,
> 
> if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
> a DataSourceFactory registered. I also do not found any code in derby
> sources that does anything about that if do not install pax-jdbc  to get
> the Driver instrumented.
> 
> Regards
> 
> Benjamin
> 
> Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
>> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
>> already updated. So it will be included in 4.2.3 release that will be on
>> vote tonight.
>>
>> Regards
>> JB
>>
>> On 04/02/2019 16:27, Alex Soto wrote:
>>> Thank you all,
>>>
>>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>>> adding only the derby feature.
>>>
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>> <ma...@nanthrax.net>> wrote:
>>>>
>>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>>> If derby now provides a DataSourceFactory then we should remove
>>>>> pax-jdbc-derby from the feature.
>>>>>
>>>>> I guess at some point derby started providing the DSF and we just forgot
>>>>> to remove the adapter bundle.
>>>>>
>>>>> Christian
>>>>>
>>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>>
>>>>>    By the way, a simple workaround is to stop or even remove the
>>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>>> opposite).
>>>>>
>>>>>    Regards
>>>>>    JB
>>>>>
>>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>>> actually registers two DataSourceFactory services:
>>>>>>
>>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>>    (which
>>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>>
>>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>>    datasource per
>>>>>> factory.
>>>>>>
>>>>>> That's why it's only when you use derby and actually, the two
>>>>>    datasource
>>>>>> services come from the two factories.
>>>>>>
>>>>>> I'm fixing that.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>>> Oh, thanks!
>>>>>>>
>>>>>>> Can you suggest a work around? 
>>>>>>> What s the ETA for a fix? 
>>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>>    too long.  
>>>>>>> Thank you for the prompt response.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Alex soto
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>
>>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>>
>>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>>                    │ Status
>>>>>>>>
>>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>>
>>>>>>>> I will fix that.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>
>>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Alex soto
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>>
>>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>>    but not
>>>>>>>>>> both), then, it should work.
>>>>>>>>>>
>>>>>>>>>> I did:
>>>>>>>>>>
>>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>>
>>>>>>>>>> then:
>>>>>>>>>>
>>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>>> And I see only one datasource service:
>>>>>>>>>>
>>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>>                  │ URL
>>>>>>>>>>                              │ Status
>>>>>>>>>>
>>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>>
>>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>>    file ?
>>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>>
>>>>>>>>>> I will check when my build is complete.
>>>>>>>>>>
>>>>>>>>>> Regards
>>>>>>>>>> JB
>>>>>>>>>>
>>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>>    1.3.0) is
>>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>>> can see
>>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>>
>>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>>
>>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>
>>>>>>>>>>>    user=enquery
>>>>>>>>>>>    password=XXXX
>>>>>>>>>>>    databaseName=querier
>>>>>>>>>>>
>>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>>
>>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>>             
>>>>>>>>>>>                                                             
>>>>>             
>>>>>>>>>>>                                                             
>>>>>             
>>>>>>>>>>>                   
>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>    ----------------------
>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>    querier
>>>>>>>>>>>     password = enquery
>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>>     service.pid =
>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>     user = enquery
>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>    Used by: 
>>>>>>>>>>>     JPA (22)
>>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>>    ----------------------
>>>>>>>>>>>     databaseName = querier
>>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>>    querier
>>>>>>>>>>>     password = enquery
>>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>>> <http://service.id/>
>>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>>     service.pid =
>>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>>     user = enquery
>>>>>>>>>>>    Provided by : 
>>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Also:
>>>>>>>>>>>
>>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>>             
>>>>>>>>>>>              │ Status
>>>>>>>>>>>
>>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>>    if the
>>>>>>>>>>> driver is MariaDB.
>>>>>>>>>>> Any clues?
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>> Alex soto
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>>> <ma...@apache.org>
>>>>>>>>>> <mailto:jbonofre@apache.org
>>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>>    <ma...@apache.org>>
>>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>> -- 
>>>>>>>> Jean-Baptiste Onofré
>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>> <ma...@apache.org>
>>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>    --
>>>>>    Jean-Baptiste Onofré
>>>>>    jbonofre@apache.org <ma...@apache.org>
>>>>> <ma...@apache.org>
>>>>>    http://blog.nanthrax.net
>>>>>    Talend - http://www.talend.com
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> -- 
>>>>> Christian Schneider
>>>>> http://www.liquid-reality.de
>>>>>
>>>>> Computer Scientist
>>>>> http://www.adobe.com
>>>>>
>>>> -- 
>>>> Jean-Baptiste Onofré
>>>> jbonofre@apache.org <ma...@apache.org>
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Benjamin Graf <be...@gmx.net>.
Hi JB,

if I install pax-jdbc-derby on a fresh Karaf 4.2.3-SNAPSHOT I do not get
a DataSourceFactory registered. I also do not found any code in derby
sources that does anything about that if do not install pax-jdbc  to get
the Driver instrumented.

Regards

Benjamin

Am 04.02.2019 um 16:30 schrieb Jean-Baptiste Onofré:
> FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
> already updated. So it will be included in 4.2.3 release that will be on
> vote tonight.
>
> Regards
> JB
>
> On 04/02/2019 16:27, Alex Soto wrote:
>> Thank you all,
>>
>> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
>> adding only the derby feature.
>>
>>
>> Best regards,
>> Alex soto
>>
>>
>>
>>
>>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>>> <ma...@nanthrax.net>> wrote:
>>>
>>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>>
>>> Regards
>>> JB
>>>
>>> On 02/02/2019 07:35, Christian Schneider wrote:
>>>> If derby now provides a DataSourceFactory then we should remove
>>>> pax-jdbc-derby from the feature.
>>>>
>>>> I guess at some point derby started providing the DSF and we just forgot
>>>> to remove the adapter bundle.
>>>>
>>>> Christian
>>>>
>>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>>
>>>>    By the way, a simple workaround is to stop or even remove the
>>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>>> opposite).
>>>>
>>>>    Regards
>>>>    JB
>>>>
>>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>>> actually registers two DataSourceFactory services:
>>>>>
>>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>>    (which
>>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>>
>>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>>    <http://osgi.jdbc.driver.name> service property.
>>>>> So pax-jdbc-config sees two factory and so it creates one
>>>>    datasource per
>>>>> factory.
>>>>>
>>>>> That's why it's only when you use derby and actually, the two
>>>>    datasource
>>>>> services come from the two factories.
>>>>>
>>>>> I'm fixing that.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>>> Oh, thanks!
>>>>>>
>>>>>> Can you suggest a work around? 
>>>>>> What s the ETA for a fix? 
>>>>>> I have a release deadline looming and I am afraid I can't wait
>>>>    too long.  
>>>>>> Thank you for the prompt response.
>>>>>>
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>
>>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>>
>>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>>                    │ Status
>>>>>>>
>>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>>
>>>>>>> I will fix that.
>>>>>>>
>>>>>>> Regards
>>>>>>> JB
>>>>>>>
>>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>
>>>>>>>> Dropping file in the etc/ directory
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Alex soto
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>>
>>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>>    but not
>>>>>>>>> both), then, it should work.
>>>>>>>>>
>>>>>>>>> I did:
>>>>>>>>>
>>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>>
>>>>>>>>> then:
>>>>>>>>>
>>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>> And I see only one datasource service:
>>>>>>>>>
>>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>>                  │ URL
>>>>>>>>>                              │ Status
>>>>>>>>>
>>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>>
>>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>>    file ?
>>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>>
>>>>>>>>> I will check when my build is complete.
>>>>>>>>>
>>>>>>>>> Regards
>>>>>>>>> JB
>>>>>>>>>
>>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>>> Hello,
>>>>>>>>>>
>>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>>    1.3.0) is
>>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>>> can see
>>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>>
>>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>>
>>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>    dataSourceName=querier
>>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>
>>>>>>>>>>    user=enquery
>>>>>>>>>>    password=XXXX
>>>>>>>>>>    databaseName=querier
>>>>>>>>>>
>>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>>
>>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>>             
>>>>>>>>>>                                                             
>>>>             
>>>>>>>>>>                                                             
>>>>             
>>>>>>>>>>                   
>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>    ----------------------
>>>>>>>>>>     databaseName = querier
>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>    querier
>>>>>>>>>>     password = enquery
>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>> <http://service.id/>
>>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>>     service.pid =
>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>     user = enquery
>>>>>>>>>>    Provided by : 
>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>    Used by: 
>>>>>>>>>>     JPA (22)
>>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>>    ----------------------
>>>>>>>>>>     databaseName = querier
>>>>>>>>>>     dataSourceName = querier
>>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>>    querier
>>>>>>>>>>     password = enquery
>>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>>     service.bundleid = 169
>>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>>> <http://service.id/>
>>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>>     service.pid =
>>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>>     service.scope = singleton
>>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>>     user = enquery
>>>>>>>>>>    Provided by : 
>>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Also:
>>>>>>>>>>
>>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>>             
>>>>>>>>>>              │ Status
>>>>>>>>>>
>>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>>    if the
>>>>>>>>>> driver is MariaDB.
>>>>>>>>>> Any clues?
>>>>>>>>>>
>>>>>>>>>> Best regards,
>>>>>>>>>> Alex soto
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>> Jean-Baptiste Onofré
>>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>>> <ma...@apache.org>
>>>>>>>>> <mailto:jbonofre@apache.org
>>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>>    <ma...@apache.org>>
>>>>>>>>> http://blog.nanthrax.net
>>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>>> Talend - http://www.talend.com
>>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>> -- 
>>>>>>> Jean-Baptiste Onofré
>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>> <ma...@apache.org>
>>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>    --
>>>>    Jean-Baptiste Onofré
>>>>    jbonofre@apache.org <ma...@apache.org>
>>>> <ma...@apache.org>
>>>>    http://blog.nanthrax.net
>>>>    Talend - http://www.talend.com
>>>>
>>>>
>>>>
>>>> -- 
>>>> -- 
>>>> Christian Schneider
>>>> http://www.liquid-reality.de
>>>>
>>>> Computer Scientist
>>>> http://www.adobe.com
>>>>
>>> -- 
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org <ma...@apache.org>
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
FYI: I did Pax JDBC 1.3.3 release yesterday, and Karaf 4.2.3-SNAPSHOT is
already updated. So it will be included in 4.2.3 release that will be on
vote tonight.

Regards
JB

On 04/02/2019 16:27, Alex Soto wrote:
> Thank you all,
> 
> The workaround worked, i.e., removed feature /pax-jdbc-derby / and
> adding only the derby feature.
> 
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb@nanthrax.net
>> <ma...@nanthrax.net>> wrote:
>>
>> That's what I'm testing: still keeping pax-jdbc-derby feature but just
>> installing the derby bundle (not the pax-jdbc wrapper bundle).
>>
>> Regards
>> JB
>>
>> On 02/02/2019 07:35, Christian Schneider wrote:
>>> If derby now provides a DataSourceFactory then we should remove
>>> pax-jdbc-derby from the feature.
>>>
>>> I guess at some point derby started providing the DSF and we just forgot
>>> to remove the adapter bundle.
>>>
>>> Christian
>>>
>>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>>> <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>>:
>>>
>>>    By the way, a simple workaround is to stop or even remove the
>>>    pax-jdbc-derby bundle, and use only the derby bundle (or the
>>> opposite).
>>>
>>>    Regards
>>>    JB
>>>
>>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>>> actually registers two DataSourceFactory services:
>>>>
>>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>>    (which
>>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>>>
>>>> Both using the same derby value for osgi.jdbc.driver.name
>>>    <http://osgi.jdbc.driver.name> service property.
>>>>
>>>> So pax-jdbc-config sees two factory and so it creates one
>>>    datasource per
>>>> factory.
>>>>
>>>> That's why it's only when you use derby and actually, the two
>>>    datasource
>>>> services come from the two factories.
>>>>
>>>> I'm fixing that.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>>> Oh, thanks!
>>>>>
>>>>> Can you suggest a work around? 
>>>>> What s the ETA for a fix? 
>>>>> I have a release deadline looming and I am afraid I can't wait
>>>    too long.  
>>>>>
>>>>> Thank you for the prompt response.
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>
>>>>>> Indeed, I can reproduce the issue embedded:
>>>>>>
>>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>>                    │ Status
>>>>>>
>>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>> jdbc:derby:derby-data/querier │ OK
>>>>>>
>>>>>> I will fix that.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>
>>>>>>>
>>>>>>> Dropping file in the etc/ directory
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Alex soto
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>>    <jb@nanthrax.net <ma...@nanthrax.net> <ma...@nanthrax.net>
>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>>>
>>>>>>>> If you install an unique provider (only derby or derbyclient,
>>>    but not
>>>>>>>> both), then, it should work.
>>>>>>>>
>>>>>>>> I did:
>>>>>>>>
>>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>>>
>>>>>>>> then:
>>>>>>>>
>>>>>>>> jdbc:ds-create -dn derbyclient -url
>>>    jdbc:derby://localhost:1527/foo foo
>>>>>>>>
>>>>>>>> And I see only one datasource service:
>>>>>>>>
>>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>>> Name      │ Service Id │ Product      │ Version
>>>                  │ URL
>>>>>>>>                              │ Status
>>>>>>>>
>>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>>>
>>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>>    file ?
>>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>>>
>>>>>>>> I will check when my build is complete.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> JB
>>>>>>>>
>>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>>    1.3.0) is
>>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>>> can see
>>>>>>>>> it created two identical Data Sources.
>>>>>>>>>
>>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>>>
>>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>    dataSourceName=querier
>>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>>>
>>>>>>>>>    user=enquery
>>>>>>>>>    password=XXXX
>>>>>>>>>    databaseName=querier
>>>>>>>>>
>>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> It creates duplicate Data Sources:
>>>>>>>>>
>>>>>>>>>    karaf@root()> service:list DataSource                    
>>>             
>>>>>>>>>                                                             
>>>             
>>>>>>>>>                                                             
>>>             
>>>>>>>>>                   
>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>    ----------------------
>>>>>>>>>     databaseName = querier
>>>>>>>>>     dataSourceName = querier
>>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>    querier
>>>>>>>>>     password = enquery
>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>     service.bundleid = 169
>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>> <http://service.id/>
>>>>>>>>> <http://service.id/>> = 238
>>>>>>>>>     service.pid =
>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>     service.scope = singleton
>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>     user = enquery
>>>>>>>>>    Provided by : 
>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>    Used by: 
>>>>>>>>>     JPA (22)
>>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>>    ----------------------
>>>>>>>>>     databaseName = querier
>>>>>>>>>     dataSourceName = querier
>>>>>>>>>     felix.fileinstall.filename
>>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>>    querier
>>>>>>>>>     password = enquery
>>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>>     service.bundleid = 169
>>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>>     service.id <http://service.id> <http://service.id>
>>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>>> <http://service.id/>
>>>>>>>>> <http://service.id/>> = 282
>>>>>>>>>     service.pid =
>>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>>     service.scope = singleton
>>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>>     user = enquery
>>>>>>>>>    Provided by : 
>>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Also:
>>>>>>>>>
>>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>>             
>>>>>>>>>              │ Status
>>>>>>>>>
>>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I think it must be specific to Derby, as the same works fine
>>>    if the
>>>>>>>>> driver is MariaDB.
>>>>>>>>> Any clues?
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Alex soto
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> Jean-Baptiste Onofré
>>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>>> <ma...@apache.org>
>>>>>>>> <mailto:jbonofre@apache.org
>>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>>    <ma...@apache.org>>
>>>>>>>> http://blog.nanthrax.net
>>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>>> Talend - http://www.talend.com
>>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> Jean-Baptiste Onofré
>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>> <ma...@apache.org>
>>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>>>
>>>>
>>>
>>>    --
>>>    Jean-Baptiste Onofré
>>>    jbonofre@apache.org <ma...@apache.org>
>>> <ma...@apache.org>
>>>    http://blog.nanthrax.net
>>>    Talend - http://www.talend.com
>>>
>>>
>>>
>>> -- 
>>> -- 
>>> Christian Schneider
>>> http://www.liquid-reality.de
>>>
>>> Computer Scientist
>>> http://www.adobe.com
>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbonofre@apache.org <ma...@apache.org>
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Alex Soto <al...@envieta.com>.
Thank you all,

The workaround worked, i.e., removed feature pax-jdbc-derby  and adding only the derby feature.


Best regards,
Alex soto




> On Feb 2, 2019, at 1:48 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> That's what I'm testing: still keeping pax-jdbc-derby feature but just
> installing the derby bundle (not the pax-jdbc wrapper bundle).
> 
> Regards
> JB
> 
> On 02/02/2019 07:35, Christian Schneider wrote:
>> If derby now provides a DataSourceFactory then we should remove
>> pax-jdbc-derby from the feature.
>> 
>> I guess at some point derby started providing the DSF and we just forgot
>> to remove the adapter bundle.
>> 
>> Christian
>> 
>> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
>> <jb@nanthrax.net <ma...@nanthrax.net>>:
>> 
>>    By the way, a simple workaround is to stop or even remove the
>>    pax-jdbc-derby bundle, and use only the derby bundle (or the opposite).
>> 
>>    Regards
>>    JB
>> 
>>    On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>>> OK, I think I found the problem: installing the pax-jdbc-derby feature
>>> actually registers two DataSourceFactory services:
>>> 
>>> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>>    (which
>>> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>>> 2. a DataSourceFactory service coming from directly Derby bundle
>>> (org.apache.derby.jdbc.AutoloadedDriver).
>>> 
>>> Both using the same derby value for osgi.jdbc.driver.name
>>    <http://osgi.jdbc.driver.name> service property.
>>> 
>>> So pax-jdbc-config sees two factory and so it creates one
>>    datasource per
>>> factory.
>>> 
>>> That's why it's only when you use derby and actually, the two
>>    datasource
>>> services come from the two factories.
>>> 
>>> I'm fixing that.
>>> 
>>> Regards
>>> JB
>>> 
>>> On 01/02/2019 19:10, Alex Soto wrote:
>>>> Oh, thanks!
>>>> 
>>>> Can you suggest a work around? 
>>>> What s the ETA for a fix? 
>>>> I have a release deadline looming and I am afraid I can't wait
>>    too long.  
>>>> 
>>>> Thank you for the prompt response.
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>>    <jb@nanthrax.net <ma...@nanthrax.net>
>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>> 
>>>>> Indeed, I can reproduce the issue embedded:
>>>>> 
>>>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>>>                    │ Status
>>>>> 
>>    ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>> jdbc:derby:derby-data/querier │ OK
>>>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>> jdbc:derby:derby-data/querier │ OK
>>>>> 
>>>>> I will fix that.
>>>>> 
>>>>> Regards
>>>>> JB
>>>>> 
>>>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>>>> How to do you provision the datasource cfg file ?
>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>> 
>>>>>> 
>>>>>> Dropping file in the etc/ directory
>>>>>> 
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>>    <jb@nanthrax.net <ma...@nanthrax.net>
>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>>>>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>>>>>> 
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>>> 
>>>>>>> If you install an unique provider (only derby or derbyclient,
>>    but not
>>>>>>> both), then, it should work.
>>>>>>> 
>>>>>>> I did:
>>>>>>> 
>>>>>>> feature:install pax-jdbc-derbyclient
>>>>>>> 
>>>>>>> then:
>>>>>>> 
>>>>>>> jdbc:ds-create -dn derbyclient -url
>>    jdbc:derby://localhost:1527/foo foo
>>>>>>> 
>>>>>>> And I see only one datasource service:
>>>>>>> 
>>>>>>> karaf@root()> jdbc:ds-list
>>>>>>> Name      │ Service Id │ Product      │ Version
>>                  │ URL
>>>>>>>                              │ Status
>>>>>>> 
>>    ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>>> 
>>>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>>>> bootstrap two db.  How to do you provision the datasource cfg
>>    file ?
>>>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>>> 
>>>>>>> I will check when my build is complete.
>>>>>>> 
>>>>>>> Regards
>>>>>>> JB
>>>>>>> 
>>>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>>>> Hello,
>>>>>>>> 
>>>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>>    1.3.0) is
>>>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>>>> can see
>>>>>>>> it created two identical Data Sources.
>>>>>>>> 
>>>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>>> 
>>>>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>    dataSourceName=querier
>>>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>>> 
>>>>>>>>    user=enquery
>>>>>>>>    password=XXXX
>>>>>>>>    databaseName=querier
>>>>>>>> 
>>>>>>>>    ops4j.preHook=querierDB
>>>>>>>> 
>>>>>>>> 
>>>>>>>> It creates duplicate Data Sources:
>>>>>>>> 
>>>>>>>>    karaf@root()> service:list DataSource                    
>>             
>>>>>>>>                                                             
>>             
>>>>>>>>                                                             
>>             
>>>>>>>>                   
>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>    ----------------------
>>>>>>>>     databaseName = querier
>>>>>>>>     dataSourceName = querier
>>>>>>>>     felix.fileinstall.filename =
>>>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>    querier
>>>>>>>>     password = enquery
>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>     service.bundleid = 169
>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>     service.id <http://service.id>
>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>> <http://service.id/>
>>>>>>>> <http://service.id/>> = 238
>>>>>>>>     service.pid =
>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>     service.scope = singleton
>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>     user = enquery
>>>>>>>>    Provided by : 
>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>>    Used by: 
>>>>>>>>     JPA (22)
>>>>>>>>    [javax.sql.DataSource]
>>>>>>>>    ----------------------
>>>>>>>>     databaseName = querier
>>>>>>>>     dataSourceName = querier
>>>>>>>>     felix.fileinstall.filename
>>>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>>>     ops4j.preHook = querierDB
>>>>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>>>>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>>    querier
>>>>>>>>     password = enquery
>>>>>>>>     pax.jdbc.managed = true
>>>>>>>>     service.bundleid = 169
>>>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>>>     service.id <http://service.id>
>>>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>>>> <http://service.id/>
>>>>>>>> <http://service.id/>> = 282
>>>>>>>>     service.pid =
>>>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>>>     service.scope = singleton
>>>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>>>     user = enquery
>>>>>>>>    Provided by : 
>>>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Also:
>>>>>>>> 
>>>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>>>    Name    │ Product      │ Version               │ URL      
>>             
>>>>>>>>              │ Status
>>>>>>>> 
>>       ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> I think it must be specific to Derby, as the same works fine
>>    if the
>>>>>>>> driver is MariaDB.
>>>>>>>> Any clues?
>>>>>>>> 
>>>>>>>> Best regards,
>>>>>>>> Alex soto
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> -- 
>>>>>>> Jean-Baptiste Onofré
>>>>>>> jbonofre@apache.org <ma...@apache.org>
>>>>>>> <mailto:jbonofre@apache.org
>>    <ma...@apache.org>> <mailto:jbonofre@apache.org
>>    <ma...@apache.org>>
>>>>>>> http://blog.nanthrax.net
>>>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>>>> Talend - http://www.talend.com
>>>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>>> 
>>>>> 
>>>>> -- 
>>>>> Jean-Baptiste Onofré
>>>>> jbonofre@apache.org <ma...@apache.org>
>>    <mailto:jbonofre@apache.org <ma...@apache.org>>
>>>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>>>> Talend - http://www.talend.com <http://www.talend.com/>
>>>> 
>>> 
>> 
>>    -- 
>>    Jean-Baptiste Onofré
>>    jbonofre@apache.org <ma...@apache.org>
>>    http://blog.nanthrax.net
>>    Talend - http://www.talend.com
>> 
>> 
>> 
>> -- 
>> -- 
>> Christian Schneider
>> http://www.liquid-reality.de
>> 
>> Computer Scientist
>> http://www.adobe.com
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com


Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
That's what I'm testing: still keeping pax-jdbc-derby feature but just
installing the derby bundle (not the pax-jdbc wrapper bundle).

Regards
JB

On 02/02/2019 07:35, Christian Schneider wrote:
> If derby now provides a DataSourceFactory then we should remove
> pax-jdbc-derby from the feature.
> 
> I guess at some point derby started providing the DSF and we just forgot
> to remove the adapter bundle.
> 
> Christian
> 
> Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré
> <jb@nanthrax.net <ma...@nanthrax.net>>:
> 
>     By the way, a simple workaround is to stop or even remove the
>     pax-jdbc-derby bundle, and use only the derby bundle (or the opposite).
> 
>     Regards
>     JB
> 
>     On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
>     > OK, I think I found the problem: installing the pax-jdbc-derby feature
>     > actually registers two DataSourceFactory services:
>     >
>     > 1. a DataSourceFactory service coming from pax-jdbc-derby bundle
>     (which
>     > is normal) (org.apache.derby.jdbc.EmbeddedDriver)
>     > 2. a DataSourceFactory service coming from directly Derby bundle
>     > (org.apache.derby.jdbc.AutoloadedDriver).
>     >
>     > Both using the same derby value for osgi.jdbc.driver.name
>     <http://osgi.jdbc.driver.name> service property.
>     >
>     > So pax-jdbc-config sees two factory and so it creates one
>     datasource per
>     > factory.
>     >
>     > That's why it's only when you use derby and actually, the two
>     datasource
>     > services come from the two factories.
>     >
>     > I'm fixing that.
>     >
>     > Regards
>     > JB
>     >
>     > On 01/02/2019 19:10, Alex Soto wrote:
>     >> Oh, thanks!
>     >>
>     >> Can you suggest a work around? 
>     >> What s the ETA for a fix? 
>     >> I have a release deadline looming and I am afraid I can't wait
>     too long.  
>     >>
>     >> Thank you for the prompt response.
>     >>
>     >> Best regards,
>     >> Alex soto
>     >>
>     >>
>     >>
>     >>
>     >>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré
>     <jb@nanthrax.net <ma...@nanthrax.net>
>     >>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>     >>>
>     >>> Indeed, I can reproduce the issue embedded:
>     >>>
>     >>> Name    │ Service Id │ Product      │ Version               │ URL
>     >>>                    │ Status
>     >>>
>     ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>     >>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>     >>> jdbc:derby:derby-data/querier │ OK
>     >>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>     >>> jdbc:derby:derby-data/querier │ OK
>     >>>
>     >>> I will fix that.
>     >>>
>     >>> Regards
>     >>> JB
>     >>>
>     >>> On 01/02/2019 19:01, Alex Soto wrote:
>     >>>>> How to do you provision the datasource cfg file ?
>     >>>>> Using a feature or by dropping the file in the etc folder ?
>     >>>>
>     >>>>
>     >>>> Dropping file in the etc/ directory
>     >>>>
>     >>>> Best regards,
>     >>>> Alex soto
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré
>     <jb@nanthrax.net <ma...@nanthrax.net>
>     >>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>
>     >>>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>     >>>>>
>     >>>>> Hi,
>     >>>>>
>     >>>>> I just did a blog where I'm using a derby datasource (on Karaf
>     >>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>     >>>>>
>     >>>>> If you install an unique provider (only derby or derbyclient,
>     but not
>     >>>>> both), then, it should work.
>     >>>>>
>     >>>>> I did:
>     >>>>>
>     >>>>> feature:install pax-jdbc-derbyclient
>     >>>>>
>     >>>>> then:
>     >>>>>
>     >>>>> jdbc:ds-create -dn derbyclient -url
>     jdbc:derby://localhost:1527/foo foo
>     >>>>>
>     >>>>> And I see only one datasource service:
>     >>>>>
>     >>>>> karaf@root()> jdbc:ds-list
>     >>>>> Name      │ Service Id │ Product      │ Version
>                   │ URL
>     >>>>>                              │ Status
>     >>>>>
>     ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>     >>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>     >>>>> jdbc:derby://localhost:1527/scheduler │ OK
>     >>>>>
>     >>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>     >>>>> bootstrap two db.  How to do you provision the datasource cfg
>     file ?
>     >>>>> Using a feature or by dropping the file in the etc folder ?
>     >>>>>
>     >>>>> I will check when my build is complete.
>     >>>>>
>     >>>>> Regards
>     >>>>> JB
>     >>>>>
>     >>>>> On 01/02/2019 18:48, Alex Soto wrote:
>     >>>>>> Hello,
>     >>>>>>
>     >>>>>> I am experiencing a problem where /pax-jdbc-config/ (version
>     1.3.0) is
>     >>>>>> creating duplicate Derby Data Sources.  I copy the data source
>     >>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>     >>>>>> can see
>     >>>>>> it created two identical Data Sources.
>     >>>>>>
>     >>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>     >>>>>>
>     >>>>>>    osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>     >>>>>>    dataSourceName=querier
>     >>>>>>    url=jdbc:derby:derby-data/querier;create=true
>     >>>>>>
>     >>>>>>    user=enquery
>     >>>>>>    password=XXXX
>     >>>>>>    databaseName=querier
>     >>>>>>
>     >>>>>>    ops4j.preHook=querierDB
>     >>>>>>
>     >>>>>>
>     >>>>>> It creates duplicate Data Sources:
>     >>>>>>
>     >>>>>>    karaf@root()> service:list DataSource                    
>              
>     >>>>>>                                                             
>              
>     >>>>>>                                                             
>              
>     >>>>>>                   
>     >>>>>>    [javax.sql.DataSource]
>     >>>>>>    ----------------------
>     >>>>>>     databaseName = querier
>     >>>>>>     dataSourceName = querier
>     >>>>>>     felix.fileinstall.filename =
>     >>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>     >>>>>>     ops4j.preHook = querierDB
>     >>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>     >>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>     querier
>     >>>>>>     password = enquery
>     >>>>>>     pax.jdbc.managed = true
>     >>>>>>     service.bundleid = 169
>     >>>>>>     service.factoryPid = org.ops4j.datasource
>     >>>>>>     service.id <http://service.id>
>     >>>>>> <http://service.id/> <http://service.id/> <http://service.id
>     >>>>>> <http://service.id/>
>     >>>>>> <http://service.id/>> = 238
>     >>>>>>     service.pid =
>     >>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>     >>>>>>     service.scope = singleton
>     >>>>>>     url = jdbc:derby:derby-data/querier;create=true
>     >>>>>>     user = enquery
>     >>>>>>    Provided by : 
>     >>>>>>     OPS4J Pax JDBC Config (169)
>     >>>>>>    Used by: 
>     >>>>>>     JPA (22)
>     >>>>>>    [javax.sql.DataSource]
>     >>>>>>    ----------------------
>     >>>>>>     databaseName = querier
>     >>>>>>     dataSourceName = querier
>     >>>>>>     felix.fileinstall.filename
>     >>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>     >>>>>>     ops4j.preHook = querierDB
>     >>>>>>     osgi.jdbc.driver.name <http://osgi.jdbc.driver.name> = derby
>     >>>>>>     osgi.jndi.service.name <http://osgi.jndi.service.name> =
>     querier
>     >>>>>>     password = enquery
>     >>>>>>     pax.jdbc.managed = true
>     >>>>>>     service.bundleid = 169
>     >>>>>>     service.factoryPid = org.ops4j.datasource
>     >>>>>>     service.id <http://service.id>
>     >>>>>> <http://service.id/> <http://service.id/> <http://service.id
>     >>>>>> <http://service.id/>
>     >>>>>> <http://service.id/>> = 282
>     >>>>>>     service.pid =
>     >>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>     >>>>>>     service.scope = singleton
>     >>>>>>     url = jdbc:derby:derby-data/querier;create=true
>     >>>>>>     user = enquery
>     >>>>>>    Provided by : 
>     >>>>>>     OPS4J Pax JDBC Config (169)
>     >>>>>>
>     >>>>>>
>     >>>>>> Also:
>     >>>>>>
>     >>>>>>    karaf@root()> jdbc:ds-list
>     >>>>>>    Name    │ Product      │ Version               │ URL      
>              
>     >>>>>>              │ Status
>     >>>>>>
>        ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>     >>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>     >>>>>>    jdbc:derby:derby-data/querier │ OK
>     >>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>     >>>>>>    jdbc:derby:derby-data/querier │ OK
>     >>>>>>
>     >>>>>>
>     >>>>>>
>     >>>>>> I think it must be specific to Derby, as the same works fine
>     if the
>     >>>>>> driver is MariaDB.
>     >>>>>> Any clues?
>     >>>>>>
>     >>>>>> Best regards,
>     >>>>>> Alex soto
>     >>>>>>
>     >>>>>>
>     >>>>>>
>     >>>>>>
>     >>>>>
>     >>>>> -- 
>     >>>>> Jean-Baptiste Onofré
>     >>>>> jbonofre@apache.org <ma...@apache.org>
>     >>>>> <mailto:jbonofre@apache.org
>     <ma...@apache.org>> <mailto:jbonofre@apache.org
>     <ma...@apache.org>>
>     >>>>> http://blog.nanthrax.net
>     >>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>     >>>>> Talend - http://www.talend.com
>     >>>>> <http://www.talend.com/> <http://www.talend.com/>
>     >>>>
>     >>>
>     >>> -- 
>     >>> Jean-Baptiste Onofré
>     >>> jbonofre@apache.org <ma...@apache.org>
>     <mailto:jbonofre@apache.org <ma...@apache.org>>
>     >>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>     >>> Talend - http://www.talend.com <http://www.talend.com/>
>     >>
>     >
> 
>     -- 
>     Jean-Baptiste Onofré
>     jbonofre@apache.org <ma...@apache.org>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
> 
> 
> 
> -- 
> -- 
> Christian Schneider
> http://www.liquid-reality.de
> 
> Computer Scientist
> http://www.adobe.com
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Christian Schneider <ch...@die-schneider.net>.
If derby now provides a DataSourceFactory then we should remove
pax-jdbc-derby from the feature.

I guess at some point derby started providing the DSF and we just forgot to
remove the adapter bundle.

Christian

Am Sa., 2. Feb. 2019 um 07:19 Uhr schrieb Jean-Baptiste Onofré <
jb@nanthrax.net>:

> By the way, a simple workaround is to stop or even remove the
> pax-jdbc-derby bundle, and use only the derby bundle (or the opposite).
>
> Regards
> JB
>
> On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
> > OK, I think I found the problem: installing the pax-jdbc-derby feature
> > actually registers two DataSourceFactory services:
> >
> > 1. a DataSourceFactory service coming from pax-jdbc-derby bundle (which
> > is normal) (org.apache.derby.jdbc.EmbeddedDriver)
> > 2. a DataSourceFactory service coming from directly Derby bundle
> > (org.apache.derby.jdbc.AutoloadedDriver).
> >
> > Both using the same derby value for osgi.jdbc.driver.name service
> property.
> >
> > So pax-jdbc-config sees two factory and so it creates one datasource per
> > factory.
> >
> > That's why it's only when you use derby and actually, the two datasource
> > services come from the two factories.
> >
> > I'm fixing that.
> >
> > Regards
> > JB
> >
> > On 01/02/2019 19:10, Alex Soto wrote:
> >> Oh, thanks!
> >>
> >> Can you suggest a work around?
> >> What s the ETA for a fix?
> >> I have a release deadline looming and I am afraid I can't wait too
> long.
> >>
> >> Thank you for the prompt response.
> >>
> >> Best regards,
> >> Alex soto
> >>
> >>
> >>
> >>
> >>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré <jb@nanthrax.net
> >>> <ma...@nanthrax.net>> wrote:
> >>>
> >>> Indeed, I can reproduce the issue embedded:
> >>>
> >>> Name    │ Service Id │ Product      │ Version               │ URL
> >>>                    │ Status
> >>>
> ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
> >>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
> >>> jdbc:derby:derby-data/querier │ OK
> >>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
> >>> jdbc:derby:derby-data/querier │ OK
> >>>
> >>> I will fix that.
> >>>
> >>> Regards
> >>> JB
> >>>
> >>> On 01/02/2019 19:01, Alex Soto wrote:
> >>>>> How to do you provision the datasource cfg file ?
> >>>>> Using a feature or by dropping the file in the etc folder ?
> >>>>
> >>>>
> >>>> Dropping file in the etc/ directory
> >>>>
> >>>> Best regards,
> >>>> Alex soto
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré <jb@nanthrax.net
> >>>>> <ma...@nanthrax.net>
> >>>>> <ma...@nanthrax.net>> wrote:
> >>>>>
> >>>>> Hi,
> >>>>>
> >>>>> I just did a blog where I'm using a derby datasource (on Karaf
> >>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
> >>>>>
> >>>>> If you install an unique provider (only derby or derbyclient, but not
> >>>>> both), then, it should work.
> >>>>>
> >>>>> I did:
> >>>>>
> >>>>> feature:install pax-jdbc-derbyclient
> >>>>>
> >>>>> then:
> >>>>>
> >>>>> jdbc:ds-create -dn derbyclient -url
> jdbc:derby://localhost:1527/foo foo
> >>>>>
> >>>>> And I see only one datasource service:
> >>>>>
> >>>>> karaf@root()> jdbc:ds-list
> >>>>> Name      │ Service Id │ Product      │ Version               │ URL
> >>>>>                              │ Status
> >>>>>
> ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
> >>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
> >>>>> jdbc:derby://localhost:1527/scheduler │ OK
> >>>>>
> >>>>> In your case, it seems that pax-jdbc-config is in cause, like it
> >>>>> bootstrap two db.  How to do you provision the datasource cfg file ?
> >>>>> Using a feature or by dropping the file in the etc folder ?
> >>>>>
> >>>>> I will check when my build is complete.
> >>>>>
> >>>>> Regards
> >>>>> JB
> >>>>>
> >>>>> On 01/02/2019 18:48, Alex Soto wrote:
> >>>>>> Hello,
> >>>>>>
> >>>>>> I am experiencing a problem where /pax-jdbc-config/ (version 1.3.0)
> is
> >>>>>> creating duplicate Derby Data Sources.  I copy the data source
> >>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
> >>>>>> can see
> >>>>>> it created two identical Data Sources.
> >>>>>>
> >>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
> >>>>>>
> >>>>>>    osgi.jdbc.driver.name = derby
> >>>>>>    dataSourceName=querier
> >>>>>>    url=jdbc:derby:derby-data/querier;create=true
> >>>>>>
> >>>>>>    user=enquery
> >>>>>>    password=XXXX
> >>>>>>    databaseName=querier
> >>>>>>
> >>>>>>    ops4j.preHook=querierDB
> >>>>>>
> >>>>>>
> >>>>>> It creates duplicate Data Sources:
> >>>>>>
> >>>>>>    karaf@root()> service:list DataSource
>
> >>>>>>
>
> >>>>>>
>
> >>>>>>
> >>>>>>    [javax.sql.DataSource]
> >>>>>>    ----------------------
> >>>>>>     databaseName = querier
> >>>>>>     dataSourceName = querier
> >>>>>>     felix.fileinstall.filename =
> >>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
> >>>>>>     ops4j.preHook = querierDB
> >>>>>>     osgi.jdbc.driver.name = derby
> >>>>>>     osgi.jndi.service.name = querier
> >>>>>>     password = enquery
> >>>>>>     pax.jdbc.managed = true
> >>>>>>     service.bundleid = 169
> >>>>>>     service.factoryPid = org.ops4j.datasource
> >>>>>>     service.id
> >>>>>> <http://service.id/> <http://service.id/> <http://service.id
> >>>>>> <http://service.id/>
> >>>>>> <http://service.id/>> = 238
> >>>>>>     service.pid =
> >>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
> >>>>>>     service.scope = singleton
> >>>>>>     url = jdbc:derby:derby-data/querier;create=true
> >>>>>>     user = enquery
> >>>>>>    Provided by :
> >>>>>>     OPS4J Pax JDBC Config (169)
> >>>>>>    Used by:
> >>>>>>     JPA (22)
> >>>>>>    [javax.sql.DataSource]
> >>>>>>    ----------------------
> >>>>>>     databaseName = querier
> >>>>>>     dataSourceName = querier
> >>>>>>     felix.fileinstall.filename
> >>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
> >>>>>>     ops4j.preHook = querierDB
> >>>>>>     osgi.jdbc.driver.name = derby
> >>>>>>     osgi.jndi.service.name = querier
> >>>>>>     password = enquery
> >>>>>>     pax.jdbc.managed = true
> >>>>>>     service.bundleid = 169
> >>>>>>     service.factoryPid = org.ops4j.datasource
> >>>>>>     service.id
> >>>>>> <http://service.id/> <http://service.id/> <http://service.id
> >>>>>> <http://service.id/>
> >>>>>> <http://service.id/>> = 282
> >>>>>>     service.pid =
> >>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
> >>>>>>     service.scope = singleton
> >>>>>>     url = jdbc:derby:derby-data/querier;create=true
> >>>>>>     user = enquery
> >>>>>>    Provided by :
> >>>>>>     OPS4J Pax JDBC Config (169)
> >>>>>>
> >>>>>>
> >>>>>> Also:
> >>>>>>
> >>>>>>    karaf@root()> jdbc:ds-list
> >>>>>>    Name    │ Product      │ Version               │ URL
>
> >>>>>>              │ Status
> >>>>>>
>    ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
> >>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
> >>>>>>    jdbc:derby:derby-data/querier │ OK
> >>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
> >>>>>>    jdbc:derby:derby-data/querier │ OK
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>> I think it must be specific to Derby, as the same works fine if the
> >>>>>> driver is MariaDB.
> >>>>>> Any clues?
> >>>>>>
> >>>>>> Best regards,
> >>>>>> Alex soto
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
> >>>>> --
> >>>>> Jean-Baptiste Onofré
> >>>>> jbonofre@apache.org
> >>>>> <ma...@apache.org> <ma...@apache.org>
> >>>>> http://blog.nanthrax.net
> >>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
> >>>>> Talend - http://www.talend.com
> >>>>> <http://www.talend.com/> <http://www.talend.com/>
> >>>>
> >>>
> >>> --
> >>> Jean-Baptiste Onofré
> >>> jbonofre@apache.org <ma...@apache.org>
> >>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> >>> Talend - http://www.talend.com <http://www.talend.com/>
> >>
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


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

Computer Scientist
http://www.adobe.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
By the way, a simple workaround is to stop or even remove the
pax-jdbc-derby bundle, and use only the derby bundle (or the opposite).

Regards
JB

On 02/02/2019 06:55, Jean-Baptiste Onofré wrote:
> OK, I think I found the problem: installing the pax-jdbc-derby feature
> actually registers two DataSourceFactory services:
> 
> 1. a DataSourceFactory service coming from pax-jdbc-derby bundle (which
> is normal) (org.apache.derby.jdbc.EmbeddedDriver)
> 2. a DataSourceFactory service coming from directly Derby bundle
> (org.apache.derby.jdbc.AutoloadedDriver).
> 
> Both using the same derby value for osgi.jdbc.driver.name service property.
> 
> So pax-jdbc-config sees two factory and so it creates one datasource per
> factory.
> 
> That's why it's only when you use derby and actually, the two datasource
> services come from the two factories.
> 
> I'm fixing that.
> 
> Regards
> JB
> 
> On 01/02/2019 19:10, Alex Soto wrote:
>> Oh, thanks!
>>
>> Can you suggest a work around? 
>> What s the ETA for a fix? 
>> I have a release deadline looming and I am afraid I can't wait too long.  
>>
>> Thank you for the prompt response.
>>
>> Best regards,
>> Alex soto
>>
>>
>>
>>
>>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>>> <ma...@nanthrax.net>> wrote:
>>>
>>> Indeed, I can reproduce the issue embedded:
>>>
>>> Name    │ Service Id │ Product      │ Version               │ URL
>>>                    │ Status
>>> ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>> jdbc:derby:derby-data/querier │ OK
>>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>>> jdbc:derby:derby-data/querier │ OK
>>>
>>> I will fix that.
>>>
>>> Regards
>>> JB
>>>
>>> On 01/02/2019 19:01, Alex Soto wrote:
>>>>> How to do you provision the datasource cfg file ?
>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>
>>>>
>>>> Dropping file in the etc/ directory
>>>>
>>>> Best regards,
>>>> Alex soto
>>>>
>>>>
>>>>
>>>>
>>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>>> <ma...@nanthrax.net>
>>>>> <ma...@nanthrax.net>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>>
>>>>> If you install an unique provider (only derby or derbyclient, but not
>>>>> both), then, it should work.
>>>>>
>>>>> I did:
>>>>>
>>>>> feature:install pax-jdbc-derbyclient
>>>>>
>>>>> then:
>>>>>
>>>>> jdbc:ds-create -dn derbyclient -url jdbc:derby://localhost:1527/foo foo
>>>>>
>>>>> And I see only one datasource service:
>>>>>
>>>>> karaf@root()> jdbc:ds-list
>>>>> Name      │ Service Id │ Product      │ Version               │ URL
>>>>>                              │ Status
>>>>> ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>>
>>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>>> bootstrap two db.  How to do you provision the datasource cfg file ?
>>>>> Using a feature or by dropping the file in the etc folder ?
>>>>>
>>>>> I will check when my build is complete.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I am experiencing a problem where /pax-jdbc-config/ (version 1.3.0) is
>>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>>> can see
>>>>>> it created two identical Data Sources.
>>>>>>
>>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>>
>>>>>>    osgi.jdbc.driver.name = derby
>>>>>>    dataSourceName=querier
>>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>>
>>>>>>    user=enquery
>>>>>>    password=XXXX
>>>>>>    databaseName=querier
>>>>>>
>>>>>>    ops4j.preHook=querierDB
>>>>>>
>>>>>>
>>>>>> It creates duplicate Data Sources:
>>>>>>
>>>>>>    karaf@root()> service:list DataSource                              
>>>>>>                                                                       
>>>>>>                                                                       
>>>>>>                   
>>>>>>    [javax.sql.DataSource]
>>>>>>    ----------------------
>>>>>>     databaseName = querier
>>>>>>     dataSourceName = querier
>>>>>>     felix.fileinstall.filename =
>>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>     ops4j.preHook = querierDB
>>>>>>     osgi.jdbc.driver.name = derby
>>>>>>     osgi.jndi.service.name = querier
>>>>>>     password = enquery
>>>>>>     pax.jdbc.managed = true
>>>>>>     service.bundleid = 169
>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>     service.id
>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>> <http://service.id/>
>>>>>> <http://service.id/>> = 238
>>>>>>     service.pid =
>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>     service.scope = singleton
>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>     user = enquery
>>>>>>    Provided by : 
>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>    Used by: 
>>>>>>     JPA (22)
>>>>>>    [javax.sql.DataSource]
>>>>>>    ----------------------
>>>>>>     databaseName = querier
>>>>>>     dataSourceName = querier
>>>>>>     felix.fileinstall.filename
>>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>>     ops4j.preHook = querierDB
>>>>>>     osgi.jdbc.driver.name = derby
>>>>>>     osgi.jndi.service.name = querier
>>>>>>     password = enquery
>>>>>>     pax.jdbc.managed = true
>>>>>>     service.bundleid = 169
>>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>>     service.id
>>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>>> <http://service.id/>
>>>>>> <http://service.id/>> = 282
>>>>>>     service.pid =
>>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>>     service.scope = singleton
>>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>>     user = enquery
>>>>>>    Provided by : 
>>>>>>     OPS4J Pax JDBC Config (169)
>>>>>>
>>>>>>
>>>>>> Also:
>>>>>>
>>>>>>    karaf@root()> jdbc:ds-list
>>>>>>    Name    │ Product      │ Version               │ URL                
>>>>>>              │ Status
>>>>>>    ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>>
>>>>>>
>>>>>>
>>>>>> I think it must be specific to Derby, as the same works fine if the
>>>>>> driver is MariaDB.
>>>>>> Any clues?
>>>>>>
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> -- 
>>>>> Jean-Baptiste Onofré
>>>>> jbonofre@apache.org
>>>>> <ma...@apache.org> <ma...@apache.org>
>>>>> http://blog.nanthrax.net
>>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>>> Talend - http://www.talend.com
>>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>>
>>>
>>> -- 
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org <ma...@apache.org>
>>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>>> Talend - http://www.talend.com <http://www.talend.com/>
>>
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
OK, I think I found the problem: installing the pax-jdbc-derby feature
actually registers two DataSourceFactory services:

1. a DataSourceFactory service coming from pax-jdbc-derby bundle (which
is normal) (org.apache.derby.jdbc.EmbeddedDriver)
2. a DataSourceFactory service coming from directly Derby bundle
(org.apache.derby.jdbc.AutoloadedDriver).

Both using the same derby value for osgi.jdbc.driver.name service property.

So pax-jdbc-config sees two factory and so it creates one datasource per
factory.

That's why it's only when you use derby and actually, the two datasource
services come from the two factories.

I'm fixing that.

Regards
JB

On 01/02/2019 19:10, Alex Soto wrote:
> Oh, thanks!
> 
> Can you suggest a work around? 
> What s the ETA for a fix? 
> I have a release deadline looming and I am afraid I can't wait too long.  
> 
> Thank you for the prompt response.
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>> <ma...@nanthrax.net>> wrote:
>>
>> Indeed, I can reproduce the issue embedded:
>>
>> Name    │ Service Id │ Product      │ Version               │ URL
>>                    │ Status
>> ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
>> jdbc:derby:derby-data/querier │ OK
>> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
>> jdbc:derby:derby-data/querier │ OK
>>
>> I will fix that.
>>
>> Regards
>> JB
>>
>> On 01/02/2019 19:01, Alex Soto wrote:
>>>> How to do you provision the datasource cfg file ?
>>>> Using a feature or by dropping the file in the etc folder ?
>>>
>>>
>>> Dropping file in the etc/ directory
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>>>> <ma...@nanthrax.net>
>>>> <ma...@nanthrax.net>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I just did a blog where I'm using a derby datasource (on Karaf
>>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>>>
>>>> If you install an unique provider (only derby or derbyclient, but not
>>>> both), then, it should work.
>>>>
>>>> I did:
>>>>
>>>> feature:install pax-jdbc-derbyclient
>>>>
>>>> then:
>>>>
>>>> jdbc:ds-create -dn derbyclient -url jdbc:derby://localhost:1527/foo foo
>>>>
>>>> And I see only one datasource service:
>>>>
>>>> karaf@root()> jdbc:ds-list
>>>> Name      │ Service Id │ Product      │ Version               │ URL
>>>>                              │ Status
>>>> ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>>> jdbc:derby://localhost:1527/scheduler │ OK
>>>>
>>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>>> bootstrap two db.  How to do you provision the datasource cfg file ?
>>>> Using a feature or by dropping the file in the etc folder ?
>>>>
>>>> I will check when my build is complete.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>>> Hello,
>>>>>
>>>>> I am experiencing a problem where /pax-jdbc-config/ (version 1.3.0) is
>>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>>> configuration file to  Karaf's /etc/ /directory, after a while I
>>>>> can see
>>>>> it created two identical Data Sources.
>>>>>
>>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>>>
>>>>>    osgi.jdbc.driver.name = derby
>>>>>    dataSourceName=querier
>>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>>>
>>>>>    user=enquery
>>>>>    password=XXXX
>>>>>    databaseName=querier
>>>>>
>>>>>    ops4j.preHook=querierDB
>>>>>
>>>>>
>>>>> It creates duplicate Data Sources:
>>>>>
>>>>>    karaf@root()> service:list DataSource                              
>>>>>                                                                       
>>>>>                                                                       
>>>>>                   
>>>>>    [javax.sql.DataSource]
>>>>>    ----------------------
>>>>>     databaseName = querier
>>>>>     dataSourceName = querier
>>>>>     felix.fileinstall.filename =
>>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>     ops4j.preHook = querierDB
>>>>>     osgi.jdbc.driver.name = derby
>>>>>     osgi.jndi.service.name = querier
>>>>>     password = enquery
>>>>>     pax.jdbc.managed = true
>>>>>     service.bundleid = 169
>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>     service.id
>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>> <http://service.id/>
>>>>> <http://service.id/>> = 238
>>>>>     service.pid =
>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>     service.scope = singleton
>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>     user = enquery
>>>>>    Provided by : 
>>>>>     OPS4J Pax JDBC Config (169)
>>>>>    Used by: 
>>>>>     JPA (22)
>>>>>    [javax.sql.DataSource]
>>>>>    ----------------------
>>>>>     databaseName = querier
>>>>>     dataSourceName = querier
>>>>>     felix.fileinstall.filename
>>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>>     ops4j.preHook = querierDB
>>>>>     osgi.jdbc.driver.name = derby
>>>>>     osgi.jndi.service.name = querier
>>>>>     password = enquery
>>>>>     pax.jdbc.managed = true
>>>>>     service.bundleid = 169
>>>>>     service.factoryPid = org.ops4j.datasource
>>>>>     service.id
>>>>> <http://service.id/> <http://service.id/> <http://service.id
>>>>> <http://service.id/>
>>>>> <http://service.id/>> = 282
>>>>>     service.pid =
>>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>>     service.scope = singleton
>>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>>     user = enquery
>>>>>    Provided by : 
>>>>>     OPS4J Pax JDBC Config (169)
>>>>>
>>>>>
>>>>> Also:
>>>>>
>>>>>    karaf@root()> jdbc:ds-list
>>>>>    Name    │ Product      │ Version               │ URL                
>>>>>              │ Status
>>>>>    ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>>    jdbc:derby:derby-data/querier │ OK
>>>>>
>>>>>
>>>>>
>>>>> I think it must be specific to Derby, as the same works fine if the
>>>>> driver is MariaDB.
>>>>> Any clues?
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> Jean-Baptiste Onofré
>>>> jbonofre@apache.org
>>>> <ma...@apache.org> <ma...@apache.org>
>>>> http://blog.nanthrax.net
>>>> <http://blog.nanthrax.net/> <http://blog.nanthrax.net/>
>>>> Talend - http://www.talend.com
>>>> <http://www.talend.com/> <http://www.talend.com/>
>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbonofre@apache.org <ma...@apache.org>
>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>> Talend - http://www.talend.com <http://www.talend.com/>
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Alex Soto <al...@envieta.com>.
Oh, thanks!

Can you suggest a work around? 
What s the ETA for a fix? 
I have a release deadline looming and I am afraid I can't wait too long.  

Thank you for the prompt response.

Best regards,
Alex soto




> On Feb 1, 2019, at 1:05 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> Indeed, I can reproduce the issue embedded:
> 
> Name    │ Service Id │ Product      │ Version               │ URL
>                    │ Status
> ────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
> querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
> jdbc:derby:derby-data/querier │ OK
> querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
> jdbc:derby:derby-data/querier │ OK
> 
> I will fix that.
> 
> Regards
> JB
> 
> On 01/02/2019 19:01, Alex Soto wrote:
>>> How to do you provision the datasource cfg file ?
>>> Using a feature or by dropping the file in the etc folder ?
>> 
>> 
>> Dropping file in the etc/ directory
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
>>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>>> <mailto:jb@nanthrax.net <ma...@nanthrax.net>>> wrote:
>>> 
>>> Hi,
>>> 
>>> I just did a blog where I'm using a derby datasource (on Karaf
>>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874 <http://blog.nanthrax.net/?p=874>
>>> 
>>> If you install an unique provider (only derby or derbyclient, but not
>>> both), then, it should work.
>>> 
>>> I did:
>>> 
>>> feature:install pax-jdbc-derbyclient
>>> 
>>> then:
>>> 
>>> jdbc:ds-create -dn derbyclient -url jdbc:derby://localhost:1527/foo <derby://localhost:1527/foo> foo
>>> 
>>> And I see only one datasource service:
>>> 
>>> karaf@root()> jdbc:ds-list
>>> Name      │ Service Id │ Product      │ Version               │ URL
>>>                              │ Status
>>> ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>>> jdbc:derby://localhost:1527/scheduler <derby://localhost:1527/scheduler> │ OK
>>> 
>>> In your case, it seems that pax-jdbc-config is in cause, like it
>>> bootstrap two db.  How to do you provision the datasource cfg file ?
>>> Using a feature or by dropping the file in the etc folder ?
>>> 
>>> I will check when my build is complete.
>>> 
>>> Regards
>>> JB
>>> 
>>> On 01/02/2019 18:48, Alex Soto wrote:
>>>> Hello,
>>>> 
>>>> I am experiencing a problem where /pax-jdbc-config/ (version 1.3.0) is
>>>> creating duplicate Derby Data Sources.  I copy the data source
>>>> configuration file to  Karaf's /etc/ /directory, after a while I can see
>>>> it created two identical Data Sources.
>>>> 
>>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>> 
>>>>    osgi.jdbc.driver.name = derby
>>>>    dataSourceName=querier
>>>>    url=jdbc:derby:derby-data/querier;create=true
>>>> 
>>>>    user=enquery
>>>>    password=XXXX
>>>>    databaseName=querier
>>>> 
>>>>    ops4j.preHook=querierDB
>>>> 
>>>> 
>>>> It creates duplicate Data Sources:
>>>> 
>>>>    karaf@root()> service:list DataSource                              
>>>>                                                                       
>>>>                                                                       
>>>>                   
>>>>    [javax.sql.DataSource]
>>>>    ----------------------
>>>>     databaseName = querier
>>>>     dataSourceName = querier
>>>>     felix.fileinstall.filename =
>>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>     ops4j.preHook = querierDB
>>>>     osgi.jdbc.driver.name = derby
>>>>     osgi.jndi.service.name = querier
>>>>     password = enquery
>>>>     pax.jdbc.managed = true
>>>>     service.bundleid = 169
>>>>     service.factoryPid = org.ops4j.datasource
>>>>     service.id <http://service.id/> <http://service.id/ <http://service.id/>> <http://service.id <http://service.id/>
>>>> <http://service.id/ <http://service.id/>>> = 238
>>>>     service.pid =
>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>     service.scope = singleton
>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>     user = enquery
>>>>    Provided by : 
>>>>     OPS4J Pax JDBC Config (169)
>>>>    Used by: 
>>>>     JPA (22)
>>>>    [javax.sql.DataSource]
>>>>    ----------------------
>>>>     databaseName = querier
>>>>     dataSourceName = querier
>>>>     felix.fileinstall.filename
>>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>>     ops4j.preHook = querierDB
>>>>     osgi.jdbc.driver.name = derby
>>>>     osgi.jndi.service.name = querier
>>>>     password = enquery
>>>>     pax.jdbc.managed = true
>>>>     service.bundleid = 169
>>>>     service.factoryPid = org.ops4j.datasource
>>>>     service.id <http://service.id/> <http://service.id/ <http://service.id/>> <http://service.id <http://service.id/>
>>>> <http://service.id/>> = 282
>>>>     service.pid =
>>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>>     service.scope = singleton
>>>>     url = jdbc:derby:derby-data/querier;create=true
>>>>     user = enquery
>>>>    Provided by : 
>>>>     OPS4J Pax JDBC Config (169)
>>>> 
>>>> 
>>>> Also:
>>>> 
>>>>    karaf@root()> jdbc:ds-list
>>>>    Name    │ Product      │ Version               │ URL                
>>>>              │ Status
>>>>    ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>    jdbc:derby:derby-data/querier │ OK
>>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>>    jdbc:derby:derby-data/querier │ OK
>>>> 
>>>> 
>>>> 
>>>> I think it must be specific to Derby, as the same works fine if the
>>>> driver is MariaDB.
>>>> Any clues?
>>>> 
>>>> Best regards,
>>>> Alex soto
>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org <ma...@apache.org> <mailto:jbonofre@apache.org <ma...@apache.org>>
>>> http://blog.nanthrax.net <http://blog.nanthrax.net/> <http://blog.nanthrax.net/ <http://blog.nanthrax.net/>>
>>> Talend - http://www.talend.com <http://www.talend.com/> <http://www.talend.com/ <http://www.talend.com/>>
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Indeed, I can reproduce the issue embedded:

Name    │ Service Id │ Product      │ Version               │ URL
                    │ Status
────────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
querier │ 91         │ Apache Derby │ 10.13.1.1 - (1765088) │
jdbc:derby:derby-data/querier │ OK
querier │ 92         │ Apache Derby │ 10.13.1.1 - (1765088) │
jdbc:derby:derby-data/querier │ OK

I will fix that.

Regards
JB

On 01/02/2019 19:01, Alex Soto wrote:
>> How to do you provision the datasource cfg file ?
>> Using a feature or by dropping the file in the etc folder ?
> 
> 
> Dropping file in the etc/ directory
> 
> Best regards,
> Alex soto
> 
> 
> 
> 
>> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>> <ma...@nanthrax.net>> wrote:
>>
>> Hi,
>>
>> I just did a blog where I'm using a derby datasource (on Karaf
>> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874
>>
>> If you install an unique provider (only derby or derbyclient, but not
>> both), then, it should work.
>>
>> I did:
>>
>> feature:install pax-jdbc-derbyclient
>>
>> then:
>>
>> jdbc:ds-create -dn derbyclient -url jdbc:derby://localhost:1527/foo foo
>>
>> And I see only one datasource service:
>>
>> karaf@root()> jdbc:ds-list
>> Name      │ Service Id │ Product      │ Version               │ URL
>>                              │ Status
>> ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
>> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
>> jdbc:derby://localhost:1527/scheduler │ OK
>>
>> In your case, it seems that pax-jdbc-config is in cause, like it
>> bootstrap two db.  How to do you provision the datasource cfg file ?
>> Using a feature or by dropping the file in the etc folder ?
>>
>> I will check when my build is complete.
>>
>> Regards
>> JB
>>
>> On 01/02/2019 18:48, Alex Soto wrote:
>>> Hello,
>>>
>>> I am experiencing a problem where /pax-jdbc-config/ (version 1.3.0) is
>>> creating duplicate Derby Data Sources.  I copy the data source
>>> configuration file to  Karaf's /etc/ /directory, after a while I can see
>>> it created two identical Data Sources.
>>>
>>> The configuration file: /org.ops4j.datasource-querier.cfg/
>>>
>>>    osgi.jdbc.driver.name = derby
>>>    dataSourceName=querier
>>>    url=jdbc:derby:derby-data/querier;create=true
>>>
>>>    user=enquery
>>>    password=XXXX
>>>    databaseName=querier
>>>
>>>    ops4j.preHook=querierDB
>>>
>>>
>>> It creates duplicate Data Sources:
>>>
>>>    karaf@root()> service:list DataSource                              
>>>                                                                       
>>>                                                                       
>>>                   
>>>    [javax.sql.DataSource]
>>>    ----------------------
>>>     databaseName = querier
>>>     dataSourceName = querier
>>>     felix.fileinstall.filename =
>>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>     ops4j.preHook = querierDB
>>>     osgi.jdbc.driver.name = derby
>>>     osgi.jndi.service.name = querier
>>>     password = enquery
>>>     pax.jdbc.managed = true
>>>     service.bundleid = 169
>>>     service.factoryPid = org.ops4j.datasource
>>>     service.id <http://service.id/> <http://service.id
>>> <http://service.id/>> = 238
>>>     service.pid =
>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>     service.scope = singleton
>>>     url = jdbc:derby:derby-data/querier;create=true
>>>     user = enquery
>>>    Provided by : 
>>>     OPS4J Pax JDBC Config (169)
>>>    Used by: 
>>>     JPA (22)
>>>    [javax.sql.DataSource]
>>>    ----------------------
>>>     databaseName = querier
>>>     dataSourceName = querier
>>>     felix.fileinstall.filename
>>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>>     ops4j.preHook = querierDB
>>>     osgi.jdbc.driver.name = derby
>>>     osgi.jndi.service.name = querier
>>>     password = enquery
>>>     pax.jdbc.managed = true
>>>     service.bundleid = 169
>>>     service.factoryPid = org.ops4j.datasource
>>>     service.id <http://service.id/> <http://service.id
>>> <http://service.id/>> = 282
>>>     service.pid =
>>> org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>>     service.scope = singleton
>>>     url = jdbc:derby:derby-data/querier;create=true
>>>     user = enquery
>>>    Provided by : 
>>>     OPS4J Pax JDBC Config (169)
>>>
>>>
>>> Also:
>>>
>>>    karaf@root()> jdbc:ds-list
>>>    Name    │ Product      │ Version               │ URL                
>>>              │ Status
>>>    ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>    jdbc:derby:derby-data/querier │ OK
>>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>>    jdbc:derby:derby-data/querier │ OK
>>>
>>>
>>>
>>> I think it must be specific to Derby, as the same works fine if the
>>> driver is MariaDB.
>>> Any clues?
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>
>>
>> -- 
>> Jean-Baptiste Onofré
>> jbonofre@apache.org <ma...@apache.org>
>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>> Talend - http://www.talend.com <http://www.talend.com/>
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Alex Soto <al...@envieta.com>.
> How to do you provision the datasource cfg file ?
> Using a feature or by dropping the file in the etc folder ?


Dropping file in the etc/ directory

Best regards,
Alex soto




> On Feb 1, 2019, at 12:57 PM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> 
> Hi,
> 
> I just did a blog where I'm using a derby datasource (on Karaf
> 4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874 <http://blog.nanthrax.net/?p=874>
> 
> If you install an unique provider (only derby or derbyclient, but not
> both), then, it should work.
> 
> I did:
> 
> feature:install pax-jdbc-derbyclient
> 
> then:
> 
> jdbc:ds-create -dn derbyclient -url jdbc:derby://localhost:1527/foo <derby://localhost:1527/foo> foo
> 
> And I see only one datasource service:
> 
> karaf@root()> jdbc:ds-list
> Name      │ Service Id │ Product      │ Version               │ URL
>                              │ Status
> ────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
> foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
> jdbc:derby://localhost:1527/scheduler <derby://localhost:1527/scheduler> │ OK
> 
> In your case, it seems that pax-jdbc-config is in cause, like it
> bootstrap two db.  How to do you provision the datasource cfg file ?
> Using a feature or by dropping the file in the etc folder ?
> 
> I will check when my build is complete.
> 
> Regards
> JB
> 
> On 01/02/2019 18:48, Alex Soto wrote:
>> Hello,
>> 
>> I am experiencing a problem where /pax-jdbc-config/ (version 1.3.0) is
>> creating duplicate Derby Data Sources.  I copy the data source
>> configuration file to  Karaf's /etc/ /directory, after a while I can see
>> it created two identical Data Sources.
>> 
>> The configuration file: /org.ops4j.datasource-querier.cfg/
>> 
>>    osgi.jdbc.driver.name = derby
>>    dataSourceName=querier
>>    url=jdbc:derby:derby-data/querier;create=true
>> 
>>    user=enquery
>>    password=XXXX
>>    databaseName=querier
>> 
>>    ops4j.preHook=querierDB
>> 
>> 
>> It creates duplicate Data Sources:
>> 
>>    karaf@root()> service:list DataSource                              
>>                                                                       
>>                                                                       
>>                   
>>    [javax.sql.DataSource]
>>    ----------------------
>>     databaseName = querier
>>     dataSourceName = querier
>>     felix.fileinstall.filename =
>>    file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>     ops4j.preHook = querierDB
>>     osgi.jdbc.driver.name = derby
>>     osgi.jndi.service.name = querier
>>     password = enquery
>>     pax.jdbc.managed = true
>>     service.bundleid = 169
>>     service.factoryPid = org.ops4j.datasource
>>     service.id <http://service.id/> <http://service.id <http://service.id/>> = 238
>>     service.pid = org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>     service.scope = singleton
>>     url = jdbc:derby:derby-data/querier;create=true
>>     user = enquery
>>    Provided by : 
>>     OPS4J Pax JDBC Config (169)
>>    Used by: 
>>     JPA (22)
>>    [javax.sql.DataSource]
>>    ----------------------
>>     databaseName = querier
>>     dataSourceName = querier
>>     felix.fileinstall.filename
>>    = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>>     ops4j.preHook = querierDB
>>     osgi.jdbc.driver.name = derby
>>     osgi.jndi.service.name = querier
>>     password = enquery
>>     pax.jdbc.managed = true
>>     service.bundleid = 169
>>     service.factoryPid = org.ops4j.datasource
>>     service.id <http://service.id/> <http://service.id <http://service.id/>> = 282
>>     service.pid = org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>>     service.scope = singleton
>>     url = jdbc:derby:derby-data/querier;create=true
>>     user = enquery
>>    Provided by : 
>>     OPS4J Pax JDBC Config (169)
>> 
>> 
>> Also:
>> 
>>    karaf@root()> jdbc:ds-list
>>    Name    │ Product      │ Version               │ URL                
>>              │ Status
>>    ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>    jdbc:derby:derby-data/querier │ OK
>>    querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>>    jdbc:derby:derby-data/querier │ OK
>> 
>> 
>> 
>> I think it must be specific to Derby, as the same works fine if the
>> driver is MariaDB.
>> Any clues?
>> 
>> Best regards,
>> Alex soto
>> 
>> 
>> 
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>

Re: OPS4J Pax JDBC + Derby = Duplicate DataSource

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

I just did a blog where I'm using a derby datasource (on Karaf
4.2.3-SNAPSHOT): http://blog.nanthrax.net/?p=874

If you install an unique provider (only derby or derbyclient, but not
both), then, it should work.

I did:

feature:install pax-jdbc-derbyclient

then:

jdbc:ds-create -dn derbyclient -url jdbc:derby://localhost:1527/foo foo

And I see only one datasource service:

karaf@root()> jdbc:ds-list
Name      │ Service Id │ Product      │ Version               │ URL
                              │ Status
────┼────────────┼──────────────┼───────────────────────┼───────────────────────────────────────┼───────
foo │ 91         │ Apache Derby │ 10.14.2.0 - (1828579) │
jdbc:derby://localhost:1527/scheduler │ OK

In your case, it seems that pax-jdbc-config is in cause, like it
bootstrap two db.  How to do you provision the datasource cfg file ?
Using a feature or by dropping the file in the etc folder ?

I will check when my build is complete.

Regards
JB

On 01/02/2019 18:48, Alex Soto wrote:
> Hello,
> 
> I am experiencing a problem where /pax-jdbc-config/ (version 1.3.0) is
> creating duplicate Derby Data Sources.  I copy the data source
> configuration file to  Karaf's /etc/ /directory, after a while I can see
> it created two identical Data Sources.
> 
> The configuration file: /org.ops4j.datasource-querier.cfg/
> 
>     osgi.jdbc.driver.name = derby
>     dataSourceName=querier
>     url=jdbc:derby:derby-data/querier;create=true
> 
>     user=enquery
>     password=XXXX
>     databaseName=querier
> 
>     ops4j.preHook=querierDB
> 
> 
> It creates duplicate Data Sources:
> 
>     karaf@root()> service:list DataSource                              
>                                                                        
>                                                                        
>                    
>     [javax.sql.DataSource]
>     ----------------------
>      databaseName = querier
>      dataSourceName = querier
>      felix.fileinstall.filename =
>     file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>      ops4j.preHook = querierDB
>      osgi.jdbc.driver.name = derby
>      osgi.jndi.service.name = querier
>      password = enquery
>      pax.jdbc.managed = true
>      service.bundleid = 169
>      service.factoryPid = org.ops4j.datasource
>      service.id <http://service.id> = 238
>      service.pid = org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>      service.scope = singleton
>      url = jdbc:derby:derby-data/querier;create=true
>      user = enquery
>     Provided by : 
>      OPS4J Pax JDBC Config (169)
>     Used by: 
>      JPA (22)
>     [javax.sql.DataSource]
>     ----------------------
>      databaseName = querier
>      dataSourceName = querier
>      felix.fileinstall.filename
>     = file:/Users/asoto/test/etc/org.ops4j.datasource-querier.cfg
>      ops4j.preHook = querierDB
>      osgi.jdbc.driver.name = derby
>      osgi.jndi.service.name = querier
>      password = enquery
>      pax.jdbc.managed = true
>      service.bundleid = 169
>      service.factoryPid = org.ops4j.datasource
>      service.id <http://service.id> = 282
>      service.pid = org.ops4j.datasource.b161e768-e5f8-40bb-b19f-40cab9111316
>      service.scope = singleton
>      url = jdbc:derby:derby-data/querier;create=true
>      user = enquery
>     Provided by : 
>      OPS4J Pax JDBC Config (169)
> 
> 
> Also:
> 
>     karaf@root()> jdbc:ds-list
>     Name    │ Product      │ Version               │ URL                
>               │ Status
>     ────────┼──────────────┼───────────────────────┼───────────────────────────────┼───────
>     querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>     jdbc:derby:derby-data/querier │ OK
>     querier │ Apache Derby │ 10.13.1.1 - (1765088) │
>     jdbc:derby:derby-data/querier │ OK
> 
> 
> 
> I think it must be specific to Derby, as the same works fine if the
> driver is MariaDB.
> Any clues?
> 
> Best regards,
> Alex soto
> 
> 
> 
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com