SAP Hybris Connection with Oracle DB

2k views Asked by At

What all i need to change in the DB properties here?

#db.url=jdbc:oracle:thin:@<host>:1522:<sid>
   #db.driver=oracle.jdbc.driver.OracleDriver
   #db.username=<system>
   #db.password=<password>
   #db.tableprefix=

I am using Hybris 6.2 and wanted to connect it to Oracle 11g. I have downloaded Oracle11g,SqlDeveloper and made a connection between them. I've copied the Oracle Db server properties into the local.properties file of the Config folder in Hybris.

However i'm not able to understand the steps after that (what all info i need to put in connection properties above, do i have to intialize and upadate again?).

1

There are 1 answers

0
reichhart On

Avoid nasty OCI driver configuration.

Because geffchang's answer only shows the configuration with the OCI driver I'm showing here the most simple configuration with the thin client.

Reference is https://help.sap.com/viewer/a74589c3a81a4a95bf51d87258c0ab15/1905/en-US/551f907063044685a309a8b22f5779c3.html

  1. You already wrote how db.url looks like with thin client by specifying host, port and sid. Here are some examples: jdbc:oracle:thin:@192.168.1.1:1521:orcl jdbc:oracle:thin:@//ora01-ic.mydomain.net:1532/hybris jdbc:oracle:thin:@//ora901scan.de.mydomain.net:1523/shop
  2. db.driver=oracle.jdbc.driver.OracleDriver
  3. username and password should be self explanatory.
  4. Avoid tableprefix. You only need it if you want to have multiple hybris instances within a single DB. But if you need multiple instances you could alternatively also create a second DB in the Oracle DBMS (see difference between DB and DBMS!) and use an additional SID like e.g. hybris2.

That's all: host/ip, port, SID, username and password. Three configuration lines depending on your local environment and one static db.driver setting.

OCI vs. Thin driver

I mostly use the Thin driver. The way the hybris documentation explains the usage of the OCI driver is somewhat nasty (to avoid the term "insecure") by using LD_LIBRARY_PATH instead of using ld.conf.

Using the Thin driver is platform-independent and most easy to configure. Using OCI is the opposite and depends on the OS. OCI with LD_LIBRARY_PATH is targeted towards Linux.

Reference OCI: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/jjdbc/JDBC-OCI-features.html#GUID-A8201BD0-BAED-4C54-B53B-C26C5F295B32

Reference Thin client: https://docs.oracle.com/cd/B28359_01/java.111/b31224/jdbcthin.htm

The JDBC driver

It must be put into bin/platform/lib/dbdriver. Current version at time of this writing is ojdbc8-12.2.0.1.0.jar. Here's a list with other versions and timestamps matching their release dates:

$ ls -lnG ojdbc*jar
-rw-r--r-- 1 501 2739670 Jul 28  2014 ojdbc6-11.2.0.4.jar
-rw-r--r-- 1 501 3397734 Jun 25  2013 ojdbc7-12.1.0.1.jar
-rw-r--r-- 1 501 3698857 Apr 11  2016 ojdbc7-12.1.0.2.jar
-rw-r--r-- 1 501 4036257 Mar  1  2017 ojdbc8-12.2.0.1.0.jar

Other settings

db.pool: The values in geffchang's answer are the default values already set in advanced.properties. You don't need to specify them a second time.

oracle.statementcachesize: In Hybris docs referenced above it is mentioned "Do not set any other value than 0". In fact you don't need to set it at all.

tenant.restart.on.connection.error: Usually you don't need to set it. Keeping it on true (default in advanced.properties) MAY cause your DB to be locked at Hybris startup with wrong password because Hybris will try to connect to DB several times and some Oracle DB admins activate an user lock on e.g. 3rd failed login. In this case ask the Oracle admin to provide the correct password and to unlock the account.