Using Oracle Autonomous Database Serverless 131 140
Using Oracle Autonomous Database Serverless 131 140
Using Oracle Autonomous Database Serverless 131 140
See About Database Actions in Using Oracle Database Actions for more information.
Note:
If your Autonomous Database is configured to use a Private Endpoint, then
you can only access Database Actions from clients in the same Virtual Cloud
Network (VCN).
See Configuring Network Access with Private Endpoints for more
information.
3-54
Chapter 3
Connect to Autonomous Database
3-55
Chapter 3
Connect to Autonomous Database
3-56
Chapter 3
Connect to Autonomous Database
Access Database Actions, Oracle APEX, Oracle REST Data Services, and
Developer Tools Using a Vanity URL
By default you access Oracle APEX apps, REST endpoints, and developer tools on
Autonomous Database using the oraclecloudapps.com domain name. You can optionally
configure a vanity URL or custom domain name that is easy to remember to help promote
your brand identity.
After you acquire a desired domain name and matching SSL certificate from a vendor of your
choice, deploy an Oracle Cloud Infrastructure Load Balancer in your Virtual Cloud Network
(VCN) using your Autonomous Database as the backend. Your Autonomous Database
instance must be configured with a private endpoint in the same VCN. See Configuring
Network Access with Private Endpoints for more information.
To learn more, see the following:
• Introducing Vanity URLs for APEX and ORDS on Oracle Autonomous Database
• Automate Vanity URL Configuration Using Terraform
3-57
Chapter 3
Connect to Autonomous Database
Note:
If you use TLS (instead of mTLS) for your connections using JDBC Thin
Driver with JDK8u162 or higher, a wallet is not required.
3-58
Chapter 3
Connect to Autonomous Database
Using a JDBC URL Connection String with JDBC Thin Driver and Wallets
The connection string is found in the file tnsnames.ora which is part of the client
credentials download. The tnsnames.ora file contains the predefined service names. Each
service has its own TNS alias and connection string.
A sample entry, with dbname_high as the TNS alias and a connection string in
tnsnames.ora follows:
dbname_high= (description=
(address=(protocol=tcps)(port=1522)(host=adb.example.oraclecloud.com))
3-59
Chapter 3
Connect to Autonomous Database
(connect_data=(service_name=dbname_high.oraclecloud.com))
(security=(ssl_server_dn_match=yes)))
Set the location of tnsnames.ora with the property TNS_ADMIN in one of the following
ways:
• As part of the connection string (only with the 18.3 or newer JDBC driver)
• As a system property, -Doracle.net.tns_admin
• As a connection property (OracleConnection.CONNECTION_PROPERTY_TNS_ADMIN)
Using the 18.3 JDBC driver, the connection string includes the TNS alias and the
TNS_ADMIN connection property.
DB_URL="jdbc:oracle:thin:@dbname_high?TNS_ADMIN=/Users/test/
wallet_dbname"
DB_URL="jdbc:oracle:thin:@dbname_high?TNS_ADMIN=C:\\Users\\test\
\wallet_dbname"
Note:
If you are using 12.2.0.1 or older JDBC drivers, then the connection string
contains only the TNS alias. To connect using older JDBC drivers:
• Set the location of the tnsnames.ora, either as a system property with
-Doracle.net.tns_admin or as a connection property
(OracleConnection.CONNECTION_PROPERTY_TNS_ADMIN).
• Set the wallet or JKS related connection properties in addition to
TNS_ADMIN.
For example, in this case you set the TNS alias in the DB_URL without the
TNS_ADMIN part as:
DB_URL=”jdbc:oracle:thin:@dbname_high”
See Predefined Database Service Names for Autonomous Database for more details.
3-60
Chapter 3
Connect to Autonomous Database
DB_URL="jdbc:oracle:thin:@dbname_high?TNS_ADMIN=/Users/test/wallet_dbname"
Note:
If you are using Microsoft Active Directory with a database, then in the sample
source code update the username with the Active Directory username and
update the password with the Active Directory user password. See Use
Microsoft Active Directory with Autonomous Database for more information.
3. Set the wallet location: The properties file ojdbc.properties is pre-loaded with the
wallet related connection property.
oracle.net.wallet_location=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=$
{TNS_ADMIN})))
Note:
You do not modify the file ojdbc.properties. The value of TNS_ADMIN
determines the wallet location.
4. Compile and Run: Compile and run the sample to get a successful connection. Make
sure you have oraclepki.jar , osdt_core.jar, and osdt_cert.jar, in the classpath.
For example:
java –classpath
./lib/ojdbc8.jar:./lib/ucp.jar:./lib/oraclepki.jar:./lib/
osdt_core.jar:./lib/osdt_cert.jar:. UCPSample
3-61
Chapter 3
Connect to Autonomous Database
Note:
The auto-login wallet part of Autonomous Database downloaded client
credentials zip file removes the need for your application to use username/
password authentication.
DB_URL="jdbc:oracle:thin:@dbname_high?TNS_ADMIN=/Users/test/
wallet_dbname"
Note:
If you are using Microsoft Active Directory with Autonomous Database,
then make sure to change the sample source code to use the Active
Directory username and the Active Directory user password. See Use
Microsoft Active Directory with Autonomous Database for more
information.
3. Set JKS related connection properties: Add the JKS related connection
properties to ojdbc.properties file. The keyStore and truststore password are
the password specified when you downloading the client credentials .zip file.
To use SSL connectivity instead of Oracle Wallet, specify the keystore and
truststore files and their respective password in the ojdbc.properties file as
follows:
3-62
Chapter 3
Connect to Autonomous Database
Note:
Make sure to comment the wallet related property in ojdbc.properties. For
example:
4. Compile and Run: Compile and run the sample to get a successful connection. For
example:
DB_URL="jdbc:oracle:thin:@dbname_high”
Note:
If you are using Microsoft Active Directory with Autonomous Database, then
update the sample source code to use the Active Directory username and
Active Directory user password. See Use Microsoft Active Directory with
Autonomous Database for more information.
3-63