simple example to connect to ORACLE Cloud DB using the Wallet

package YOUR_PACKAGE;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import java.util.Properties;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.pool.OracleDataSource;

public class TestDBConnect {
    final static String DB_URL = "jdbc:oracle:thin:/@DB_NAME_high?TNS_ADMIN=/etc/oracle/wallet";
    final static String DB_USER = "USERNAME";
    final static String DB_PASSWORD = "PASSWORD";

    public static void main(String args[]) throws SQLException {
        Properties info = new Properties();

       info.put(OracleConnection.CONNECTION_PROPERTY_USER_NAME, DB_USER);
       info.put(OracleConnection.CONNECTION_PROPERTY_PASSWORD, DB_PASSWORD);
       // set other properties at your taste
       info.put(OracleConnection.CONNECTION_PROPERTY_DEFAULT_ROW_PREFETCH, "20");
       info.put(OracleConnection.CONNECTION_PROPERTY_AUTOCOMMIT, Boolean.FALSE);
       info.put(OracleConnection.CONNECTION_PROPERTY_FAN_ENABLED, Boolean.FALSE);

       OracleDataSource ods = new OracleDataSource();

       ods.setURL(DB_URL);
       ods.setConnectionProperties(info);

       try (OracleConnection connection = (OracleConnection) ods.getConnection()) {

              try (Statement statement = connection.createStatement()) {
                  try (ResultSet resultSet = statement.executeQuery("YOUR QUERY")) {

                      while (resultSet.next()) {
                         ...
                      }
                  }
               }
           }
       }
}

The Maven pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0
  <groupId>YOUR_GROUP
  <artifactId>YOUR_ARTIFACT
  <version>0.0.1-SNAPSHOT
  <name>Test JDBC Wallet

  <properties>
    <project.build.sourceEncoding>UTF-8
    <project.reporting.outputEncoding>UTF-8
    <jdk.version>11
    <java.version>11

    <ojdbc8.version>21.9.0.0

    <maven.compiler.source>11
    <maven.compiler.target>11
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.oracle.database.jdbc
      <artifactId>ojdbc8
      <version>${ojdbc8.version}
    </dependency>
    <dependency>
      <groupId>com.oracle.database.jdbc
      <artifactId>ucp
      <version>${ojdbc8.version}
    </dependency>
    <dependency>
      <groupId>com.oracle.database.security
      <artifactId>oraclepki
      <version>${ojdbc8.version}
    </dependency>
    <dependency>
      <groupId>com.oracle.database.xml
      <artifactId>xdb
      <version>${ojdbc8.version}
    </dependency>
    <dependency>
      <groupId>com.oracle.database.xml
      <artifactId>xmlparserv2
      <version>${ojdbc8.version}
    </dependency>

    <dependency>
      <groupId>com.oracle.database.security
      <artifactId>osdt_core
      <version>${ojdbc8.version}
    </dependency>
    <dependency>
      <groupId>com.oracle.database.security
      <artifactId>osdt_cert
      <version>${ojdbc8.version}
    </dependency>
  </dependencies>
</project>