You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Paul Spencer <pa...@mindspring.com> on 2022/04/29 15:57:38 UTC
jdbc:ds-create command and "to create the datasource definition file"?
Karaf 4.3.6
The documentation, https://karaf.apache.org/manual/latest/#_datasources_jdbc, for the "name" argument in the command "jdbc:ds-create" states "to create the datasource definition file (deploy/datasource-[name].xml)." I do not see a file created in the deploy directory, but I do see a file in the cache directory for the "Apache Felix Configuration Admin Service" bundle with a generated name.
1) Is this phase inaccurate and should be removed from the documentation?
2) If the phrase is correct, how does one create the file in the deploy directory?
***
* Example of creating JDBC Datasource and looking of the created data definition file in the deploy directory
**
karaf@root()> jdbc:ds-create -dn hsqldb -url "dbc:hsqldb:mem:." -u sa myDb
karaf@root()> ds-list
Name │ Service Id │ Product │ Version │ URL │ Status
──────────────────┼────────────┼──────────────────────┼──────────────────────────┼─────────────────────────────────────────────────────┼───────
myDb │ 177 │ HSQL Database Engine │ 2.5.1 │ jdbc:hsqldb:dbc:hsqldb:mem:. │ OK
karaf@root()> config:list '(service.factoryPid=org.ops4j.datasource)'
----------------------------------------------------------------
Pid: org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015
FactoryPid: org.ops4j.datasource
BundleLocation: mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.5.0
Properties:
dataSourceName = myDb
osgi.jdbc.driver.name = hsqldb
service.factoryPid = org.ops4j.datasource
service.pid = org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015
url = dbc:hsqldb:mem:.
user = sa
karaf@root()> shell:ls deploy
. .. README
karaf@root()>
karaf@root()> list -t 0 12
START LEVEL 100 , List Threshold: 0
ID │ State │ Lvl │ Version │ Name
───┼────────┼─────┼─────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────12 │ Active │ 10 │ 1.9.22 │ Apache Felix Configuration Admin Service
karaf@root()>
karaf@root()> shell:ls -l data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
-rw-r--r-- 1 paul staff 252 Apr 29 11:30 data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
karaf@root()>
karaf@root()> shell:cat data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
:org.apache.felix.configadmin.revision:=L"1"
dataSourceName="myDb"
osgi.jdbc.driver.name="hsqldb"
service.factoryPid="org.ops4j.datasource"
service.pid="org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015"
url="dbc:hsqldb:mem:."
user="sa"
karaf@root()> karaf@root()>
Paul Spencer
Re: jdbc:ds-create command and "to create the datasource definition file"?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Paul,
Actually pax-jdbc-config is the opposite: it creates a datasource
based on config.
I have to check what jdbc:ds-create does (I don't remember to be
honest): if it just creates the in-memory config (directly via
ConfigAdmin service), hen it's normal you don't have a cfg file
created.
Regards
JB
On Sat, Apr 30, 2022 at 6:10 PM Paul Spencer <pa...@mindspring.com> wrote:
>
> JB,
> The feature pax-jdbc-config is installed and it is referenced in "BundleLocation: mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.5.0"
>
> karaf@root()> feature:list --installed | grep -i pax-jdbc | sort
> pax-jdbc │ 1.5.0 │ x │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides JDBC Service support
> pax-jdbc-config │ 1.5.0 │ x │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides JDBC Config support
> pax-jdbc-hsqldb │ 1.5.0 │ x │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides JDBC HSQLDB DataSourceFactory
> pax-jdbc-pool-dbcp2 │ 1.5.0 │ x │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides JDBC Pooling DataSourceFactory
> pax-jdbc-spec │ 1.5.0 │ │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides OSGi JDBC Service spec
> karaf@root()>
>
> Paul Spencer
>
>
> > On Apr 30, 2022, at 12:24 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
> >
> > Hi,
> >
> > The documentation is correct if we have pax-jdbc-config feature
> > installed. A factory config should be created in etc for the
> > datasource.
> >
> > Let me take a look but it's fine afair.
> >
> > Regards
> > JB
> >
> > On Fri, Apr 29, 2022 at 5:57 PM Paul Spencer <pa...@mindspring.com> wrote:
> >>
> >> Karaf 4.3.6
> >>
> >> The documentation, https://karaf.apache.org/manual/latest/#_datasources_jdbc, for the "name" argument in the command "jdbc:ds-create" states "to create the datasource definition file (deploy/datasource-[name].xml)." I do not see a file created in the deploy directory, but I do see a file in the cache directory for the "Apache Felix Configuration Admin Service" bundle with a generated name.
> >>
> >> 1) Is this phase inaccurate and should be removed from the documentation?
> >>
> >> 2) If the phrase is correct, how does one create the file in the deploy directory?
> >>
> >> ***
> >> * Example of creating JDBC Datasource and looking of the created data definition file in the deploy directory
> >> **
> >> karaf@root()> jdbc:ds-create -dn hsqldb -url "dbc:hsqldb:mem:." -u sa myDb
> >> karaf@root()> ds-list
> >> Name │ Service Id │ Product │ Version │ URL │ Status
> >> ──────────────────┼────────────┼──────────────────────┼──────────────────────────┼─────────────────────────────────────────────────────┼───────
> >> myDb │ 177 │ HSQL Database Engine │ 2.5.1 │ jdbc:hsqldb:dbc:hsqldb:mem:. │ OK
> >> karaf@root()> config:list '(service.factoryPid=org.ops4j.datasource)'
> >> ----------------------------------------------------------------
> >> Pid: org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015
> >> FactoryPid: org.ops4j.datasource
> >> BundleLocation: mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.5.0
> >> Properties:
> >> dataSourceName = myDb
> >> osgi.jdbc.driver.name = hsqldb
> >> service.factoryPid = org.ops4j.datasource
> >> service.pid = org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015
> >> url = dbc:hsqldb:mem:.
> >> user = sa
> >> karaf@root()> shell:ls deploy
> >> . .. README
> >> karaf@root()>
> >> karaf@root()> list -t 0 12
> >> START LEVEL 100 , List Threshold: 0
> >> ID │ State │ Lvl │ Version │ Name
> >> ───┼────────┼─────┼─────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────12 │ Active │ 10 │ 1.9.22 │ Apache Felix Configuration Admin Service
> >> karaf@root()>
> >> karaf@root()> shell:ls -l data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
> >> -rw-r--r-- 1 paul staff 252 Apr 29 11:30 data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
> >> karaf@root()>
> >> karaf@root()> shell:cat data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
> >> :org.apache.felix.configadmin.revision:=L"1"
> >> dataSourceName="myDb"
> >> osgi.jdbc.driver.name="hsqldb"
> >> service.factoryPid="org.ops4j.datasource"
> >> service.pid="org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015"
> >> url="dbc:hsqldb:mem:."
> >> user="sa"
> >> karaf@root()> karaf@root()>
> >>
> >>
> >> Paul Spencer
>
Re: jdbc:ds-create command and "to create the datasource definition file"?
Posted by Paul Spencer <pa...@mindspring.com>.
JB,
The feature pax-jdbc-config is installed and it is referenced in "BundleLocation: mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.5.0"
karaf@root()> feature:list --installed | grep -i pax-jdbc | sort
pax-jdbc │ 1.5.0 │ x │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides JDBC Service support
pax-jdbc-config │ 1.5.0 │ x │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides JDBC Config support
pax-jdbc-hsqldb │ 1.5.0 │ x │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides JDBC HSQLDB DataSourceFactory
pax-jdbc-pool-dbcp2 │ 1.5.0 │ x │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides JDBC Pooling DataSourceFactory
pax-jdbc-spec │ 1.5.0 │ │ Started │ org.ops4j.pax.jdbc-1.5.0 │ Provides OSGi JDBC Service spec
karaf@root()>
Paul Spencer
> On Apr 30, 2022, at 12:24 AM, Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>
> Hi,
>
> The documentation is correct if we have pax-jdbc-config feature
> installed. A factory config should be created in etc for the
> datasource.
>
> Let me take a look but it's fine afair.
>
> Regards
> JB
>
> On Fri, Apr 29, 2022 at 5:57 PM Paul Spencer <pa...@mindspring.com> wrote:
>>
>> Karaf 4.3.6
>>
>> The documentation, https://karaf.apache.org/manual/latest/#_datasources_jdbc, for the "name" argument in the command "jdbc:ds-create" states "to create the datasource definition file (deploy/datasource-[name].xml)." I do not see a file created in the deploy directory, but I do see a file in the cache directory for the "Apache Felix Configuration Admin Service" bundle with a generated name.
>>
>> 1) Is this phase inaccurate and should be removed from the documentation?
>>
>> 2) If the phrase is correct, how does one create the file in the deploy directory?
>>
>> ***
>> * Example of creating JDBC Datasource and looking of the created data definition file in the deploy directory
>> **
>> karaf@root()> jdbc:ds-create -dn hsqldb -url "dbc:hsqldb:mem:." -u sa myDb
>> karaf@root()> ds-list
>> Name │ Service Id │ Product │ Version │ URL │ Status
>> ──────────────────┼────────────┼──────────────────────┼──────────────────────────┼─────────────────────────────────────────────────────┼───────
>> myDb │ 177 │ HSQL Database Engine │ 2.5.1 │ jdbc:hsqldb:dbc:hsqldb:mem:. │ OK
>> karaf@root()> config:list '(service.factoryPid=org.ops4j.datasource)'
>> ----------------------------------------------------------------
>> Pid: org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015
>> FactoryPid: org.ops4j.datasource
>> BundleLocation: mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.5.0
>> Properties:
>> dataSourceName = myDb
>> osgi.jdbc.driver.name = hsqldb
>> service.factoryPid = org.ops4j.datasource
>> service.pid = org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015
>> url = dbc:hsqldb:mem:.
>> user = sa
>> karaf@root()> shell:ls deploy
>> . .. README
>> karaf@root()>
>> karaf@root()> list -t 0 12
>> START LEVEL 100 , List Threshold: 0
>> ID │ State │ Lvl │ Version │ Name
>> ───┼────────┼─────┼─────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────12 │ Active │ 10 │ 1.9.22 │ Apache Felix Configuration Admin Service
>> karaf@root()>
>> karaf@root()> shell:ls -l data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
>> -rw-r--r-- 1 paul staff 252 Apr 29 11:30 data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
>> karaf@root()>
>> karaf@root()> shell:cat data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
>> :org.apache.felix.configadmin.revision:=L"1"
>> dataSourceName="myDb"
>> osgi.jdbc.driver.name="hsqldb"
>> service.factoryPid="org.ops4j.datasource"
>> service.pid="org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015"
>> url="dbc:hsqldb:mem:."
>> user="sa"
>> karaf@root()> karaf@root()>
>>
>>
>> Paul Spencer
Re: jdbc:ds-create command and "to create the datasource definition file"?
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,
The documentation is correct if we have pax-jdbc-config feature
installed. A factory config should be created in etc for the
datasource.
Let me take a look but it's fine afair.
Regards
JB
On Fri, Apr 29, 2022 at 5:57 PM Paul Spencer <pa...@mindspring.com> wrote:
>
> Karaf 4.3.6
>
> The documentation, https://karaf.apache.org/manual/latest/#_datasources_jdbc, for the "name" argument in the command "jdbc:ds-create" states "to create the datasource definition file (deploy/datasource-[name].xml)." I do not see a file created in the deploy directory, but I do see a file in the cache directory for the "Apache Felix Configuration Admin Service" bundle with a generated name.
>
> 1) Is this phase inaccurate and should be removed from the documentation?
>
> 2) If the phrase is correct, how does one create the file in the deploy directory?
>
> ***
> * Example of creating JDBC Datasource and looking of the created data definition file in the deploy directory
> **
> karaf@root()> jdbc:ds-create -dn hsqldb -url "dbc:hsqldb:mem:." -u sa myDb
> karaf@root()> ds-list
> Name │ Service Id │ Product │ Version │ URL │ Status
> ──────────────────┼────────────┼──────────────────────┼──────────────────────────┼─────────────────────────────────────────────────────┼───────
> myDb │ 177 │ HSQL Database Engine │ 2.5.1 │ jdbc:hsqldb:dbc:hsqldb:mem:. │ OK
> karaf@root()> config:list '(service.factoryPid=org.ops4j.datasource)'
> ----------------------------------------------------------------
> Pid: org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015
> FactoryPid: org.ops4j.datasource
> BundleLocation: mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.5.0
> Properties:
> dataSourceName = myDb
> osgi.jdbc.driver.name = hsqldb
> service.factoryPid = org.ops4j.datasource
> service.pid = org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015
> url = dbc:hsqldb:mem:.
> user = sa
> karaf@root()> shell:ls deploy
> . .. README
> karaf@root()>
> karaf@root()> list -t 0 12
> START LEVEL 100 , List Threshold: 0
> ID │ State │ Lvl │ Version │ Name
> ───┼────────┼─────┼─────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────12 │ Active │ 10 │ 1.9.22 │ Apache Felix Configuration Admin Service
> karaf@root()>
> karaf@root()> shell:ls -l data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
> -rw-r--r-- 1 paul staff 252 Apr 29 11:30 data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
> karaf@root()>
> karaf@root()> shell:cat data/cache/bundle12/data/config/org/ops4j/datasource/ad014501-2db1-4455-abb9-ced214fee015.config
> :org.apache.felix.configadmin.revision:=L"1"
> dataSourceName="myDb"
> osgi.jdbc.driver.name="hsqldb"
> service.factoryPid="org.ops4j.datasource"
> service.pid="org.ops4j.datasource.ad014501-2db1-4455-abb9-ced214fee015"
> url="dbc:hsqldb:mem:."
> user="sa"
> karaf@root()> karaf@root()>
>
>
> Paul Spencer