Create a Data Source for an ATP Database

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

Following is an example of model Yaml template for app deployment with ATP datasource 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:
        JDBCDriverParams:
          DriverName: oracle.jdbc.OracleDriver
          URL: '@@SECRET:@@ENV:DOMAIN_UID@@-datasource-secret:url@@'
          PasswordEncrypted: '@@SECRET:@@ENV:DOMAIN_UID@@-datasource-secret:password@@'
          Properties:
            user:
              Value:
            javax.net.ssl.keyStore:
              Value:
            javax.net.ssl.keyStoreType:
              Value: JKS
            javax.net.ssl.keyStorePassword:
              Value: '@@SECRET:@@ENV:DOMAIN_UID@@-keystore-secret:password@@'
            javax.net.ssl.trustStore:
              Value:
            javax.net.ssl.trustStoreType:
              Value: JKS
            javax.net.ssl.trustStorePassword:
              Value: '@@SECRET:@@ENV:DOMAIN_UID@@-keystore-secret:password@@'
            oracle.net.ssl_version:
              Value: '1.2'
            oracle.net.ssl_server_dn_match:
              Value: true
            oracle.net.tns_admin:
              Value:
            oracle.jdbc.fanEnabled:
              Value: false
        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. See Prerequisites to Create a Data Source.

When you create a data source for an ATP database, you need the ATP client credentials or wallet files. So, you must run the download script before you create the data source. See Download the ATP Wallet.

To create a data source for an ATP database:
  1. Update the Properties section in the model Yaml template.

    For example, update keyStore and trustStore file locations from the downloaded ATP wallet, tns_admin to point to the directory of the ATP wallet, and the schema user you created in Prerequisites to Create a Data Source.

    Properties:
      user:
        Value: <schema user>
      javax.net.ssl.keyStore:
        Value: /u01/shared/atp_wallet/keystore.jks
      javax.net.ssl.trustStore:
        Value: /u01/shared/atp_wallet/truststore.jks
      oracle.net.tns_admin:
        Value: /u01/shared/atp_wallet
  2. Create the data source secrets in the model Yaml file as follows:
    1. Create <domainuid>-datasource-secret with password and url using the kubectl command.

      Example:

      kubectl create secret generic <domainuid>-datasource-secret --from-literal=password=<password>
      --from-literal=url='jdbc:oracle:thin:@(description=(retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.us-ashburn-1.oraclecloud.com))(connect_data=(service_name=<service_name>))(security=(ssl_server_dn_match=yes)))' -n <domainname>-ns
    2. Create the <domainuid>-keystore-secret with the password used to download the ATP wallet using the kubectl command.

      For example:

      kubectl create secret generic <domainuid>-keystore-secret --from-literal=password=<password> -n <domainname>-ns

      Note:

      You must use single quotes ' ' to escape special characters such as $, \, *, =, and ! in your strings. Otherwise, your shell will interpret these characters and the create secret command will fail.