Create a Data Source for a DB System Database

Use the model Yaml templates to create a data source for an Oracle Cloud Infrastructure Database.

Following is an example of model Yaml template for app deployment with single-instance (SI) DB System data source properties:

Note:

The template files are located at /u01/shared/scripts/pipeline/templates on the administration host.
resources:
  JDBCSystemResource:
    hellods:
      Target: '@@ENV:RESOURCE_PREFIX@@-cluster'
      JdbcResource:
        JDBCDataSourceParams:
          JNDIName: jdbc/hellods
        JDBCDriverParams:
          DriverName: oracle.jdbc.OracleDriver
          URL: '@@SECRET:@@ENV:DOMAIN_UID@@-datasource-secret:url@@'
          PasswordEncrypted: '@@SECRET:@@ENV:DOMAIN_UID@@-datasource-secret:password@@'
          Properties:
            user:
              Value:
            oracle.net.CONNECT_TIMEOUT:
              Value: '120000'
            SendStreamAsBlob:
              Value: true
        JDBCConnectionPoolParams:
          InitialCapacity: 1
          MaxCapacity: 1
          TestTableName: SQL ISVALID
          TestConnectionsOnReserve: true

You must set up the database to create a schema user before you create the data source and update . See Prerequisites to Create a Data Source.

  1. Update the schema user that you created in the Properties section in the model Yaml template.

    See Prerequisites to Create a Data Source.

    For example:

    Properties:
      user:
        Value: <schema user>
      
  2. Create the data source secrets in the model Yaml file as follows:
    1. Obtain the tns connect string using the python script.
      python /u01/scripts/db/db_util.py get-connect-string
    2. Create <domain_uid>-datasource-secret with password and url using the kubectl command.

      For example:

      kubectl create secret generic <domain_name>-datasource-secret --from-literal=password=<password>
      --from-literal=url='jdbc:oracle:thin:@//wrdb19-scan.subnet2ad2phx.paasdevjcsphx.oraclevcn.com:1521/WRPDB.SUBNET2AD2PHX.PAASDEVJCSPHX.ORACLEVCN.COM'
      -n <resource_prefix>-domain-ns