Re: Configuring Sling 10 to use RDBDocumentStore with OracleDB

2018-12-05 Thread Robert Munteanu
On Tue, 2018-12-04 at 14:30 -0700, mkcons wrote:
> Hi Robert,
> 
> I don't know how your answer worked for the OP but it worked quite
> nicely
> for me.
> 
> Just one detail, I had to add the "datasource.name" in the
> DataSourceFactory
> configuration.
> 
> [configurations runModes=oak_db2]
>   org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService
> documentStoreType="RDB"
> 
>   org.apache.sling.datasource.DataSourceFactory
>   url="jdbc:db2://192.168.2.3:5/sling"
>   driverClassName="com.ibm.db2.jcc.DB2Driver"
>   username=""
>   password=""
>   datasource.name="oak"

Nice, thanks for confirming that!

Robert



Re: Configuring Sling 10 to use RDBDocumentStore with OracleDB

2018-12-04 Thread mkcons
Hi Robert,

I don't know how your answer worked for the OP but it worked quite nicely
for me.

Just one detail, I had to add the "datasource.name" in the DataSourceFactory
configuration.

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

  org.apache.sling.datasource.DataSourceFactory
url="jdbc:db2://192.168.2.3:5/sling"
driverClassName="com.ibm.db2.jcc.DB2Driver"
username=""
password=""
datasource.name="oak"

Thanks,




--
Sent from: http://apache-sling.73963.n3.nabble.com/Sling-Users-f73968.html


Re: Configuring Sling 10 to use RDBDocumentStore with OracleDB

2018-11-20 Thread Robert Munteanu
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