Configuring Oracle

Database creation

Create tablespace

create tablespace OPENKMDATA datafile '/u01/app/oracle/oradata/XE/openkmdata.dbf' size 100M;

Create a database and user

create user OPENKM identified by *secret* default tablespace OPENKMDATA quota unlimited on OPENKMDATA;
grant all privileges to OPENKM;
grant create any context, create cluster, create dimension, create indextype, create job, create materialized view, create operator, create procedure, create sequence, create session, create synonym, create table, create trigger, create type, create view to OPENKM;

Configure your openkm.properties

This configuration property should be set before the database creation. Once the database has been initialized, don't modify it because it can damage your installation.

If your OpenKM installation has already been configured with another database, you can't switch to another database by changing this property.

Choose the dialect that fits better with your database version:

  • Oracle10gDialect
  • Oracle12cDialect
  • Oracle8iDialect
  • Oracle9iDialect
  • Oracle9Dialect: deprecated, use Oracle9iDialect or Oracle10gDialect
  • OracleDialect: deprecated; use Oracle8iDialect

Edit the file $TOMCAT_HOME/openkm.properties

spring.jpa.properties.hibernate.dialect=com.openkm.db.dialect.Oracle10gDialect
spring.jpa.hibernate.ddl-auto=create-only

Configure Tomcat data sources

Edit the file $TOMCAT_HOME/openkm.properties and enable the resource named jdbc/OpenKMDS

spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:XE
spring.datasource.username=OPENKM
spring.datasource.password=*secret*
spring.datasource.validationQuery=select 1 from dual

Sample using a service name instead of SID:

The main difference between SID connections is the ":" is replaced by "/."

spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@localhost:1521/ServiceName
spring.datasource.username=OPENKM
spring.datasource.password=*secret*
spring.datasource.validationQuery=select 1 from dual

Another sample:

spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(HOST=localhost)(PROTOCOL=TCP)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE)(SERVER=DEDICATED)))
spring.datasource.username=OPENKM
spring.datasource.password=*secret*
spring.datasource.validationQuery=select 1 from dual

Configure the values of the attributes named:

  • Username.
  • Password.
  • URL ( change to your hosts and port ).

If you find this error starting the tomcat:

 ORA-01882: timezone region not found

Put this line in the file $CATALINA_BASE/bin/setenv.sh:

JAVA_OPTS=-Doracle.jdbc.timezoneAsRegion=false

Configure application login

Edit the file $. TOMCAT_HOME/openkm.properties

authentication.openkm.database=true

Run application

As a process into OpenKM startup, the application will automatically create an empty database structure. 

Once the tables are created, OpenKM will automatically change the hibernate.hbm2ddl property from create-only to none.