Thanks, can you please create a Jira about that ? I will fix the name change behavior.
Regards JB On Fri, Apr 29, 2022 at 6:48 PM Paul Spencer <[email protected]> wrote: > > Karaf 4.3.6 > > The example below demonstrates how to update the configuration of a JDBC > datasource using Karaf commands. I was unable to find a concise procedure in > the Karaf documentation and wanted to document a procedure for myself and > others. > > > 1) Create the datasource "myDb", in this case with an incorrect username of > "foo" using the "jdbc:ds-create ..." command > karaf@root()> jdbc:ds-create -dn hsqldb -url "dbc:hsqldb:mem:." -u foo -p bar > myDb > > 2) List the datasource showing the new datasource has an "invalid > authorization" status using the "jdbc:ds-list" command > karaf@root()> jdbc:ds-list > Name │ Service Id │ Product │ Version > │ URL │ Status > ──────────────────┼────────────┼──────────────────────┼──────────────────────────┼─────────────────────────────────────────────────────┼───────────────────────────────────────────────────── > 178 │ │ │ > │ │ Error invalid > authorization specification - not found: foo > > > 3) Identify the Pid for the datasource "myDb" using the "config:list > '(service.factoryPid=org.ops4j.datasource)'" command > karaf@root()> config:list '(service.factoryPid=org.ops4j.datasource)' > ---------------------------------------------------------------- > Pid: org.ops4j.datasource.40c82a9b-e74a-4e8b-86a6-676ffed33b0e > FactoryPid: org.ops4j.datasource > BundleLocation: mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.5.0 > Properties: > dataSourceName = myDb > osgi.jdbc.driver.name = hsqldb > password = bar > service.factoryPid = org.ops4j.datasource > service.pid = org.ops4j.datasource.40c82a9b-e74a-4e8b-86a6-676ffed33b0e > url = dbc:hsqldb:mem:. > user = foo > > 4) Open and list properties for the datasource "myDb" using the "config:edit > org.ops4j.datasource.<Pid>" command, where <Pid> is from above for the > dataSourceName myDb > karaf@root()> config:edit > org.ops4j.datasource.40c82a9b-e74a-4e8b-86a6-676ffed33b0e > karaf@root()> config:property-list > dataSourceName = myDb > osgi.jdbc.driver.name = hsqldb > password = bar > url = dbc:hsqldb:mem:. > user = foo > 5) Make the configuration changes, in this case setting the user to "sa" and > removing the password, using the config:property-... commands > karaf@root()> config:property-set user sa > karaf@root()> config:property-delete password > karaf@root()> config:property-list > dataSourceName = myDbAsFoo > osgi.jdbc.driver.name = hsqldb > url = dbc:hsqldb:mem:. > user = sa > > 6) Save the the configuration changes using the "config:update" command > karaf@root()> config:update > > 7) List the datasources, showing a correctly configured "myDb" > karaf@root()> jdbc:ds-list > Name │ Service Id │ Product │ Version > │ URL │ Status > ──────────────────┼────────────┼──────────────────────┼──────────────────────────┼─────────────────────────────────────────────────────┼─────── > myDb │ 179 │ HSQL Database Engine │ 2.5.1 > │ jdbc:hsqldb:dbc:hsqldb:mem:. │ OK > karaf@root()>
