Is it possible to specify at configuration a JDBC datasource to be created when Karaf boots the first time?
For information, I'm learning using Karaf JDBC (https://karaf.apache.org/manual/latest/#_datasources_jdbc) and then Karaf JPA (https://karaf.apache.org/manual/latest/#_persistence_jpa) to replace our current implementation which is based on Spring (spring-orm and spring-jdbc)
I'm following the examples of Christian from https://github.com/apache/aries/tree/trunk/jpa/examples/
where I've found the example commandjdbc:ds-create -dn H2-pool-xa -url jdbc:h2:mem:tasklist tasklist
that creates a data source and publish to OSGi registry its service:
Property | Value
driver.version | 1.3.172 (2013-05-25)
db.version | 1.3.172 (2013-05-25)
db.product | H2
url | jdbc:h2:mem:tasklist
dataSourceName = tasklist
service.bundleid = 222
service.factoryPid = org.ops4j.datasource
service.pid = org.ops4j.datasource.ac08f704-67e1-40c8-8855-9e3e262f8a9e
service.scope = singleton
url = jdbc:h2:mem:tasklist
Provided by :
OPS4J Pax JDBC Config (222)
Apache Karaf :: JDBC :: Core (226)
Thank you !
Yes you can create a DataSource that is available on first boot.
To make this work you need to add the pax-jdbc features that are needed for your DataSource to the boot features.
In your example that should be: pax-jdbc-config pax-jdbc-pool-dbcp2 pax-jdbc-h2 transaction
Then you also need to put a DataSource config in etc.
If you then start karaf the DataSource service should come up.
On 05.04.2017 11:43, Cristiano Costantini wrote:
-- Christian Schneider http://www.liquid-reality.de Open Source Architect http://www.talend.com
Hi Christian and thank you for the help,
Ok for adding features at boot, I understand.
About "Then you also need to put a DataSource config in etc.", how can I add this configuration?
Should I create a new file or do I need to edit an existing file in the distribution?
my Karaf etc folder does not contains any file with jdbc (or pax-jdbc) in its name, neither after installing the feature...
Il giorno mer 5 apr 2017 alle ore 11:54 Christian Schneider <[hidden email]> ha scritto:
oh! I've just found this page
you created it only 4 days ago!
It seems the answer to my question, I'll try this approach ;-)
Il giorno mer 5 apr 2017 alle ore 13:32 Cristiano Costantini <[hidden email]> ha scritto:
|Free forum by Nabble||Edit this page|