nomisvai / oracle-oci-database-tools-service-samples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

oracle-oci-database-tools-service-samples

This repository contains code snippets presented as unit tests demonstrating how to use the new Oracle Cloud Database Tools Service with java.

The Database Tools Service allows the use of a Rest Enabled SQL Service endpoint with pre-defined Connections that leverage the OCI Vault, Private Endpoints and OCI based access control and policies.

In other words, a Database Tools Connection will allow SQL statements to be sent securely to your database from any host using an OCI Identity. The Database Tools Service is also integrated with Private Endpoints which allows it to reach databases in private subnets.

Features In This Demo

The File TestSamples.java has 5 ordered tests:

  • Download a wallet from an Autonomous Databased Shared and uploads its cwallet.sso and password to an oci vault
  • Create a Database Tools Private Endpoint if the ADB-S requires it.
  • Create a Database Tools Connection
  • Validates the Database Tools Connection
  • Executes an SQL statement on the database using the Database Tools Service REST-Enabled SQL endpoint

All resources(Secrets, Private Endpoint, Database Tools Connection) will be created in the same compartment as the database and their ids, once created, can be found in the testconfig/resource.properties file.

Setting up the environment

  1. Create an Autonomous Database Shared

  2. Create a Vault

  3. Setup oci cli, the tests require a valid profile in the oci config file with the proper permissions to perform all the operations.

  4. When oci cli is working, edit testconfig/config.properties and provide:

    • The created Autonomous Database Shared Id
    • The created Vault Id
    • An oci config profile name that has all the necessary access to the database compartment which is used by the tests for all resources.
    • A DB User and password (the password will be added as a secret in the Vault)

How to run

mvn clean install

And look at the "T E S T S" output.

About

License:MIT License


Languages

Language:Java 100.0%