Hi Mohammad,

On Fri, 2018-11-09 at 14:02 -0500, Mohammad wrote:
> Hi,
> 
> (Sorry I originally sent this on the d...@sling.apache.org list by
> accident.)
> 
> The documentation for RDBDocumentStore (here: 
> https://jackrabbit.apache.org/oak/docs/apidocs/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.html)
>  
> mentions Oracle as a supported database so I've been trying to
> figure 
> out how to configure Sling to use it.
> 
> The first question I have is, what versions of Oracle DB are 
> supported/tested against?

That question is more for the Jackrabbit/Oak team. We do not have any
specific tests for the RDB part. Actually, it's not even included in
the Slingstart.

> 
> The second question is, how do I configure a modified sling webapp
> war 
> file to use Jackrabbit Oak with an Oracle DB backend?

I would start by modifying the current Sling starter, seems easier :-)

First of all, check out the code from

  https://github.com/apache/sling-org-apache-sling-starter

Then need to add another run mode which configures the Oracle DB for
persistence. I have not tried this at all, so it might simply blow up,
but I hope it's at least a step in the right direction

diff --git a/src/main/provisioning/boot.txt b/src/main/provisioning/boot.txt
index fc31337..1253c17 100644
--- a/src/main/provisioning/boot.txt
+++ b/src/main/provisioning/boot.txt
@@ -25,7 +25,7 @@
 # oak_tar and oak_mongo run modes are mutually exclusive,
 # and cannot be changed after the first startup
 [settings]
-    sling.run.mode.install.options=oak_tar,oak_mongo
+    sling.run.mode.install.options=oak_tar,oak_mongo,oak_rdb_oracle
     repository.home=${sling.home}/repository
     localIndexDir=${sling.home}/repository/index
 
diff --git a/src/main/provisioning/oak.txt b/src/main/provisioning/oak.txt
index 4621efc..a2f7a7d 100644
--- a/src/main/provisioning/oak.txt
+++ b/src/main/provisioning/oak.txt
@@ -50,6 +50,11 @@
     org.mongodb/mongo-java-driver/3.6.4
     com.h2database/h2-mvstore/1.4.194
 
+[artifacts startLevel=15 runModes=oak_rdb_oracle]
+    # Note - add oracle JDBC driver here
+   org.apache.sling/org.apache.sling.datasource/1.0.2
+    
+
 # start the Oak server instance after all components have been configured
 # and started to avoid restarting that component ( see SLING-4556 )
 [artifacts startLevel=16]
@@ -99,3 +104,14 @@
   org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService
     mongouri="mongodb://localhost:27017"
     db="sling"
+
+[configurations runModes=oak_rdb_oracle]
+  org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService
+    documentStoreType="RDB"
+
+  # Note - adjust connection data in url, username, password
+  org.apache.sling.datasource.DataSourceFactory-oak.config
+    url="jdbc:oracle:thin:localhost:port:SID"
+    driverClassName="oracle.jdbc.OracleDriver"
+    username="test"
+    password="test"


After that you can rebuild sling

$ mvn clean package

And run with 

$ java -jar ... -Dsling.run.modes=oak_rdb_oracle

Let me know how that works, would be good to know :-)

Thanks,

Robert

Reply via email to