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é <j...@nanthrax.net
>> <mailto:j...@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é <j...@nanthrax.net
>>>> <mailto:j...@nanthrax.net>
>>>> <mailto:j...@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é
>>>> jbono...@apache.org
>>>> <mailto:jbono...@apache.org> <mailto:jbono...@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é
>> jbono...@apache.org <mailto:jbono...@apache.org>
>> http://blog.nanthrax.net <http://blog.nanthrax.net/>
>> Talend - http://www.talend.com <http://www.talend.com/>
> 

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

Reply via email to