Discussion:
Configuring Sling 10 to use RDBDocumentStore with OracleDB
Mohammad
2018-11-09 19:02:57 UTC
Permalink
Hi,

(Sorry I originally sent this on the ***@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?

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

I think I need to create an "WEB-INF/resources/config/oak_oracle/"
folder inside the war file and then set
"sling.run.mode.install.options=oak_oracle" in
"WEB-INF/sling_install.properties" but I'm not sure what config files I
need to place in the folder. The Oak documentation
(https://jackrabbit.apache.org/oak/docs/osgi_config.html) only mentions
how to configure DocumentNodeStoreService with a mongodb backend. Oak
itself seems to support creating a DocumentNodeStore with any
javax.sql.DataSource using the RDBDocumentNodeStoreBuilder including the
OracleDataSource class provided by the Oracle jdbc jar.

Also, I notice the run modes as well as configuration are also specified
in "WEB-INF/resources/provisioning/model.txt" but I don't know which
takes precedence, the files in "WEB-INF/resources/config/oak_oracle/" or
the values in "WEB-INF/resources/provisioning/model.txt" and again, I
don't know what configuration to put in the model.txt.

I'd appreciate any help. Thanks a lot!
Robert Munteanu
2018-11-20 15:12:19 UTC
Permalink
Hi Mohammad,
Post by Mohammad
Hi,
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.
Post by Mohammad
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
mkcons
2018-12-04 21:30:03 UTC
Permalink
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:50000/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
Robert Munteanu
2018-12-05 14:40:58 UTC
Permalink
Post by 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:50000/sling"
driverClassName="com.ibm.db2.jcc.DB2Driver"
username="****"
password="****"
datasource.name="oak"
Nice, thanks for confirming that!

Robert

Loading...