2
votes

I am on Sling 11, which uses Jackrabbit Oak as content repository. I was wondering how to set up Sling to store the JCR repo on an RDBMS (DB2 to be specific).

I found this link on Jackrabbit Persistence, but looks like it does not apply to Oak and Oak documentation is mostly about MongoDB.

Also found an implementation of a Cassandra Resource Provider, although that seems designed to access specific paths mapped to Cassandra without using Oak.

Thanks,

1
sling was developed as a web interface for jcr and is hardwired with oak (jcr repo), oak can use different persistence backend such as tar based segment store, mongodb, aws s3 etc. afaik any relational db is not supported ootb.awd
I think they are, [oak 1.8 release notes] (apache.org/dist/jackrabbit/oak/1.8.9/RELEASE-NOTES.txt) mentions fixes for PostgreSQL and RDB*Store, previous updates reference DB2 as well. So does, [RDBDocumentStore] (github.com/apache/jackrabbit-oak/blob/trunk/oak-store-document/…) source codemkcons
DB2 is indeed supported. If you look at the Oak test cases or oak-run, you'll see examples how to set it up.Julian Reschke
Oh.. I was not aware of this.awd
Looks like I need to pack the DB driver in an OSGi bundle, modify Sling's provisioning script to push that bundle on Felix, and then I can start setting the params in DocumentNodeStoreService.mkcons

1 Answers

2
votes

Answering here but credit goes to Sling user's mailing list

  1. Package the DB driver in an OSGi bundle
  2. Download Sling's starter project
  3. In boot.txt add a new running mode (in my case oak_db2)

    [settings] sling.run.mode.install.options=oak_tar,oak_mongo,oak_db2

  4. Download Sling's datasource project and compile it.

  5. In oak.txt configure the running mode (this will load the bundles for you in Felix):

    [artifacts startLevel=15 runModes=oak_db2] com.h2database/h2-mvstore/1.4.196 com.ibm.db2/jcc4/11.1
    org.apache.sling/org.apache.sling.datasource/1.0.3-SNAPSHOT

And set-up the services that will manage persistence:

[configurations runModes=oak_db2] 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService
documentStoreType="RDB"

org.apache.sling.datasource.DataSourceFactory   
url="jdbc:db2://10.1.2.3:50000/sling"            
driverClassName="com.ibm.db2.jcc.DB2Driver"     
username="****"     
password="****"     
datasource.name="oak"
  1. Create a 'sling' named database.
  2. run with java -jar -Dsling.run.modes=oak_db2 sling-starter.jar