You can configure your Operational Decision Manager
instance to connect to a custom external database. The database drivers must be added to the ODM
instance after the deployment is created.
About this task
Operational Decision Manager supports database connections to
custom external databases, for example Oracle.
Note: If you use a custom external database, you are responsible for the backup and recovery
process.
To use a custom external database, you need to create a data source secret and a PVC for the
driver. You must then set the externalCustomDatabase parameters in the
odm_configuration section of your custom resource file.
Tip: Sample YAML files are provided in the
cert-kubernetes/ODM/configuration/custom-external-database folder.
For more
information about downloading cert-kubernetes, see Preparing for an Enterprise deployment.
Procedure
-
Create an XML file to configure the Decision Center data source.
Name the file datasource-dc.xml.
The following example shows a configuration file for Oracle.
<server>
<!-- Declare the jar files for Oracle access through JDBC. -->
<library id="OracleLib">
<fileset dir="/drivers" includes="ojdbc*.jar"/>
</library>
<!-- Declare the database -->
<dataSource jndiName="jdbc/ilogDataSource"
isolationLevel="TRANSACTION_READ_COMMITTED"
statementCacheSize="150">
<connectionManager maxPoolSize="25"
minPoolSize="10"
connectionTimout="10s"
agedTimeout="30m"/>
<jdbcDriver libraryRef="OracleLib"/>
<properties.oracle driverType="thin"
databaseName="xe"
serverName="oracleServerName"
portNumber="1521"
user="system"
password="oracle"/>
</dataSource>
</server>
Note: The
/drivers path must not be modified. The path locates a directory in
the container. See
What to do next to push
the database driver after the deployment is created.
-
Create an XML file to configure the Decision Server data source.
Name the file datasource-ds.xml.
The following example shows a configuration file for Oracle.
<server>
<!-- Declare the jar files for Oracle access through JDBC. -->
<library id="OracleLib">
<fileset dir="/drivers" includes="ojdbc*.jar"/>
</library>
<!-- Declare the database -->
<dataSource jndiName="jdbc/resdatasource">
<jdbcDriver libraryRef="OracleLib"/>
<properties.oracle driverType="thin"
databaseName="xe"
serverName="oracleServerName"
portNumber="1521"
user="system"
password="oracle"/>
</dataSource>
</server>
-
Create a secret from the two XML files.
Use the
kubectl create secret command to create a secret. The following
example creates
customdatasource-secret.
kubectl create secret generic customdatasource-secret --from-file datasource-ds.xml --from-file datasource-dc.xml
-
Create a Persistent Volume Claim (PVC) to host the JDBC Oracle driver.
The following YAML file (
driver-pvc.yaml) defines the PVC
customdatasource-pvc.
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: customdatasource-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: <storage_class_name>
resources:
requests:
storage: 1Gi
The following kubectl command creates the
PVC.
kubectl create -f driver-pvc.yaml
-
When you configure Operational Decision Manager, use the
custom parameters for the secret and PVC you created.
In a custom resource descriptor with the Cloud Pak operator, use the following YAML:
spec:
odm_configuration:
externalCustomDatabase:
datasourceRef: customdatasource-secret
driverPvc: customdatasource-pvc
datasource_configuration:
dc_odm_datasource:
dc_database_type: "oracle"
What to do next
To be able to use a custom database, you must push the JDBC driver to the Decision Center pod by
running a kubectl cp command after you deployed the custom resource.
For example, to configure an Oracle database as your external database use the following
steps.
- Get the name of the pod for the ODM instance by using the following command.
kubectl get pods | grep instance-name
The command
returns a list of pods.
- Check that the Oracle database is up and running.
- Add the Oracle JDBC driver to one of the pods that are listed from step 1 by running the
following
command.
kubectl cp ojdbc8-12.x.x.x.jar namespace/instance-name-odm-decisioncenter-XXXXXX:/drivers/
After you added the driver, restart all the pods by using the
kubectl delete pod
command.
kubectl delete pod instance-name-odm-decisioncenter-XXXXXX \
kubectl delete pod instance-name-odm-decisionserverconsole-XXXXXX \
kubectl delete pod instance-name-odm-decisionserverruntime-XXXXXX \
kubectl delete pod instance-name-odm-decisionrunner-XXXXXX