You are on page 1of 10

Chapter 3

Connect to Autonomous Database

See View TNS Names and Connection Strings for an Autonomous Database
Instance for information on viewing and copying connection stings.
2. Start Oracle SQL Developer and in the connections panel, right-click Connections
and select New Database Connection....
3. Choose the Connection Type Custom JDBC.
4. Enter the following information:
• Name: Enter the name for this connection.
• Username: Enter the database username. You can either use the default
administrator database account ADMIN provided as part of the service or create
a new schema, and use it.
• Password: Enter the password for the database user.
• Connection Type: Select Custom JDBC.
• Custom JDBC URL: Enter the following:
jdbc:oracle:thin:@ followed by the connection string you copied in step one.

For example, a sample value for the Custom JDBC URL field is:

jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)
(address=(protocol=tcps)
(port=1521)(host=adb-preprod.us-phoenix-1.oraclecloud.com))
(connect_data=(service_name=u9adutfb2_fmexample1_medium.adb.oraclecl
oud.com))
(security=(ssl_server_dn_match=yes)))

When you copy the connection string, the values for region and databasename are
for your Autonomous Database instance.
5. Click Connect to connect to the database.

3-44
Chapter 3
Connect to Autonomous Database

Note:
If you are using Microsoft Active Directory, then for Username enter the Active
Directory "AD_domain\AD_username" (you may include double quotes), and for the
Password, enter the password for the Active Directory user. See Use Microsoft
Active Directory with Autonomous Database for more information.

Connect Oracle SQL Developer (earlier than Version 18.2) with a Wallet (mTLS)
Oracle SQL Developer is a free integrated development environment that simplifies the
development and management of Oracle Database in both traditional and cloud
deployments.
SQL Developer versions after SQL Developer 17.4.1 (or later) can connect to Autonomous
Database using an Oracle Wallet and this version contains enhancements for key
Autonomous Database features. Oracle SQL Developer and later provides support for wallet
files using the Cloud PDB Connection Type. Oracle recommends that you use version 18.2
(or later); however, earlier versions of SQL Developer will work with Autonomous Database.

To create a new connection to the Autonomous Database, do the following:


Obtain your credentials to access Autonomous Database. For more information, see
Download Client Credentials (Wallets).
1. Start Oracle SQL Developer and in the connections panel, right-click Connections and
select New Connection.

2. Choose the Connection Type Cloud PDB.

3-45
Chapter 3
Connect to Autonomous Database

3. Enter the following information:

Note:
Versions of SQL Developer starting with 18.2.0 do not require that you
enter a Keystore Password and do not provide this field. For more
information, see Connect Oracle SQL Developer with a Wallet (mTLS).

• Connection Name: Enter the name for this connection.


• Username: Enter the database username. You can either use the default
administrator database account (ADMIN) provided as part of the service or
create a new schema, and use it.
• Password: Enter the password for the database user.
• Connection Type: Select Cloud PDB.
• Configuration File : Click Browse, and select the client credentials zip file.
• Keystore Password: Enter the password generated while downloading the
client credentials from Autonomous Database.
See Download Client Credentials (Wallets).
• Service: Enter the database TNS name. The client credentials file includes a
tnsnames.ora file that provides database TNS names with corresponding
services.

Note:
If you are using Microsoft Active Directory with your database, then for
Username enter the Active Directory "AD_domain\AD_username" (you
may include double quotes), and for the Password, enter the password
for the Active Directory user. See Use Microsoft Active Directory with
Autonomous Database for more information.

3-46
Chapter 3
Connect to Autonomous Database

Connect SQL*Plus with a Wallet (mTLS)


SQL*Plus is a command-line interface used to enter SQL commands. SQL*Plus connects to
an Oracle database.
To install and configure the client and connect to the Autonomous Database using SQL*Plus
with client credentials (mTLS), do the following:
1. Prepare for Oracle Call Interface (OCI), ODBC and JDBC OCI Connections. See Prepare
for Oracle Call Interface (OCI), ODBC, and JDBC OCI Connections with Wallets (mTLS).
2. Connect using a database user, password, and database TNS name provided in the
tnsnames.ora file.
For example:
sqlplus adb_user@db2022adb_medium

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 23 15:08:48 2020


Version 19.8.0.0.0

Copyright (c) 1982, 2020, Oracle. All rights reserved.

Enter password:
Last Successful login time: Wed Nov 18 2020 12:36:56 -08:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.5.0.0.0

SQL>

Notes:

• The Oracle Wallet is transparent to SQL*Plus because the wallet location is


specified in the sqlnet.ora file. This is true for any Oracle Call Interface
(OCI), ODBC, or JDBC OCI connection.
• If you are connecting to a database using Microsoft Active Directory credentials,
then connect using an Active Directory user name in the form of
"AD_domain\AD_username" (double quotes must be included), and Active
Directory user password. See Use Microsoft Active Directory with Autonomous
Database for more information.

Connect SQL*Plus Without a Wallet


SQL*Plus is a command-line interface used to enter SQL commands. SQL*Plus connects to
an Oracle database.

Note:
See Update your Autonomous Database Instance to Allow both TLS and mTLS
Authentication for information on allowing TLS connections.

3-47
Chapter 3
Connect to Autonomous Database

To install and configure the client and connect to the Autonomous Database using
SQL*Plus with TLS authentication, do the following:
1. Prepare for Oracle Call Interface (OCI) connections.
You can use TLS authentication without a wallet in SQL*Plus if you are using the
following client versions:
• Oracle Instant Client/Oracle Database Client 19.13 - only on Linux x64
• Oracle Instant Client/Oracle Database Client 19.14 (or later) and 21.5 (or later)
- only on Linux x64 and Windows
See Prepare for Oracle Call Interface, ODBC, and JDBC OCI Connections Using
TLS Authentication for more information.
2. Copy a connection string for the Autonomous Database.
To connect with TLS authentication copy a TLS connection string. On the
Database Connection page, under TLS Authentication, select TLS to view the
connection strings for connecting with TLS authentication.
See View TNS Names and Connection Strings for an Autonomous Database
Instance for information on viewing and copying connection stings.
See Predefined Database Service Names for Autonomous Database for
information on the different databases services for each connection string.
3. Connect using a database user and password, and provide the connection string
you copied in Step 2.
On UNIX/Linux start sqlplus with the connection string, enclosed in quotes on the
command line, as follows:

sqlplus username/password@'my_connect_string'

For example (for clarity line breaks added):

sqlplus adb_user/password@'(description= (retry_count=20)


(retry_delay=3)(address=(protocol=tcps)
(port=1521)(host=adb.region.oraclecloud.com))
(connect_data=(service_name=u9adutfb2ba8x4d_database_medium.adb.orac
lecloud.com))
(security=(ssl_server_dn_match=yes))'

On Windows, start sqlplus with the database user and password with the copied
connection string, as follows (as compared to UNIX/Linux, on Windows do not
surround the connection string with quotes):

sqlplus username/password@my_connect_string

For example (for clarity line breaks added in the connection string):

sqlplus adb_user/password@(description= (retry_count=20)


(retry_delay=3)(address=(protocol=tcps)
(port=1521)(host=adb.region.oraclecloud.com))
(connect_data=(service_name=u9adutfb2ba8x4d_database_medium.adb.orac

3-48
Chapter 3
Connect to Autonomous Database

lecloud.com))
(security=(ssl_server_dn_match=yes))

Note:
If you are connecting to an Autonomous Database instance using Microsoft Active
Directory credentials, then connect using an Active Directory user name in the form
of "AD_domain\AD_username" (double quotes must be included), and Active
Directory user password. See Use Microsoft Active Directory with Autonomous
Database for more information.

Connect Oracle SQLcl Cloud with a Wallet (mTLS)


SQLcl is a command-line interface used to enter SQL commands. You can use SQLcl to
connect to an Autonomous Database with client credentials configured (mTLS).
You can use SQLcl version 4.2 or later with Autonomous Database. Download SQLcl from
oracle.com.
SQLcl can connect to an Autonomous Database instance using either an Oracle Call
Interface (OCI) or a JDBC thin connection.
• If you use Oracle Call Interface (OCI), prepare for OCI, ODBC and JDBC OCI
Connections. See Prepare for Oracle Call Interface (OCI), ODBC, and JDBC OCI
Connections.
• If you use JDBC Thin, prepare for JDBC Thin Connections. See Prepare for JDBC Thin
Connections.
SQLcl with Oracle Call Interface
To connect using Oracle Call Interface, use the –oci option, supply the database user name,
a password, and the database service name provided in the tnsnames.ora file. For
example:

sql -oci

SQLcl: Release 22.1 Production on Fri May 06 16:07:46 2022

Copyright (c) 1982, 2022, Oracle. All rights reserved.

Username? (''?) adb_user@db2022adb_medium


Password? (**********?) ***************
Connected.
SQL>

When connecting using Oracle Call Interface, the Oracle Wallet is transparent to SQLcl.
SQLcl with a JDBC Thin Connection
To connect using a JDBC Thin connection, first configure the SQLcl cloud configuration and
then connect to the database.
1. Start SQLcl with the /nolog option.

3-49
Chapter 3
Connect to Autonomous Database

sql /nolog

2. Configure the SQLcl session to use your Oracle Wallet:


SQL> set cloudconfig directory/client_credentials.zip

3. Connect to the database:


SQL> connect username@servicename
password

To avoid the prompt, connect and supply the password inline:


SQL> connect username/password@servicename

For example:

sql /nolog

SQLcl: Release 22.1 Production on Fri May 06 14:48:26 2022

Copyright (c) 1982, 2022, Oracle. All rights reserved.

SQL> set cloudconfig /home/adb/Wallet_db2022ADB.zip

SQL> connect adb_user@db2022adb_medium

Password? (**********?) ***************


Connected.
SQL>

SQLcl with a JDBC Thin Connection with an HTTP Proxy


1. Start SQLcl with the /nolog option.
sql /nolog

2. Configure the SQLcl session to use a proxy host and your Oracle Wallet:
SQL> set cloudconfig -proxy=proxyhost:port directory/client_credentials.zip

3. Connect to the database.


SQL> connect username@servicename
password

To avoid the prompt, connect and supply the password inline:


SQL> connect username/password@servicename

For example:

sql /nolog

SQLcl: Release 22.1 Production on Fri May 06 11:59:38 2022

Copyright (c) 1982, 2022, Oracle. All rights reserved.


SQL> set cloudconfig -proxy=http://myproxyhost.com:80 /home/adb/
Wallet_db2022.zip

SQL> connect adb_user@db2022adb_medium

3-50
Chapter 3
Connect to Autonomous Database

Password? (**********?) ****************


Connected.
SQL>

Note:
If you are connecting to Autonomous Database using Microsoft Active Directory
credentials, then connect using an Active Directory user name in the form of
"AD_domain\AD_username" (double quotes must be included), and Active
Directory user password. See Use Microsoft Active Directory with Autonomous
Database for more information.

For more information, on the connection types specified in tnsnames.ora, see Manage
Concurrency and Priorities on Autonomous Database.
For information on SQLcl, see Oracle SQLcl.

Connect Oracle SQLcl Cloud Without a Wallet


SQLcl is a command-line interface used to enter SQL commands. You can use SQLcl to
connect to an Autonomous Database with TLS authentication without a wallet.

Note:
See Update your Autonomous Database Instance to Allow both TLS and mTLS
Authentication for information on allowing TLS connections.

You can use SQLcl version 4.2 or later with Autonomous Database. Download SQLcl from
oracle.com.
If you use JDBC Thin Driver, prepare for JDBC Thin connections. See Prepare for JDBC Thin
Connections.
To connect using a JDBC Thin Driver with TLS authentication, do the following to connect to
the database.
1. Copy a connection string for the Autonomous Database.
To connect with TLS authentication copy a TLS connection string. On the Database
Connection page, under TLS Authentication, select TLS to view the connection strings
for connecting with TLS authentication.
See View TNS Names and Connection Strings for an Autonomous Database Instance for
information on viewing and copying connection stings.
See Predefined Database Service Names for Autonomous Database for information on
the different databases services for each connection string.
2. Start SQLcl and connect to the database:

3-51
Chapter 3
Connect to Autonomous Database

On UNIX/Linux start sql with the connection string, enclosed in quotes on the
command line, as follows:

sql username/password@'my_connect_string'

For example (for clarity line breaks added):

$ sql admin/password@'(description= (retry_count=20)(retry_delay=3)


(address=(protocol=tcps)(port=1521)
(host=adb.region.oraclecloud.com))
(connect_data=(service_name=u9adutfb2ba8x4d_database_medium.adb.orac
lecloud.com))
(security=(ssl_server_dn_match=yes)))'

SQLcl: Release 21.2 Production on Thu Sep 16 10:43:00 2021


Copyright (c) 1982, 2021, Oracle. All rights reserved.

Last Successful login time: Thu Sep 16 2021 10:43:01 -07:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 -
Production
Version 19.12.0.1.0

SQL>

On Windows, start sql with the /nolog option and then connect with the copied
connection string, as follows (as compared to UNIX/Linux, on Windows do not
surround the connection string with quotes):

> sql /nolog

SQLcl: Release 21.2 Production on Fri Sep 17 10:15:01 2021


Copyright (c) 1982, 2021, Oracle. All rights reserved.
SQL> conn username/password@my_connect_string

For example (for clarity line breaks are added):

> sql admin/password@(description= (retry_count=20)(retry_delay=3)


(address=(protocol=tcps)(port=1521)
(host=adb.region.oraclecloud.com))
(connect_data=(service_name=u9adutfb2ba8x4d_database_medium.adb.orac
lecloud.com))
(security=(ssl_server_dn_match=yes)))

SQLcl: Release 21.2 Production on Thu Sep 16 10:43:00 2021


Copyright (c) 1982, 2021, Oracle. All rights reserved.

Last Successful login time: Thu Sep 16 2021 10:43:01 -07:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 -
Production

3-52
Chapter 3
Connect to Autonomous Database

Version 19.12.0.1.0

SQL>

Note:
If you are connecting to Autonomous Database using Microsoft Active Directory
credentials, then connect using an Active Directory user name in the form of
"AD_domain\AD_username" (double quotes must be included), and Active
Directory user password. See Use Microsoft Active Directory with Autonomous
Database for more information.

For information on SQLcl, see Oracle SQLcl.

Connect with Built-In Oracle Database Actions


You can access Database Actions from Autonomous Database. Database Actions provides
development tools, data tools, administration, and monitoring features for Autonomous
Database. Using Database Actions you can run SQL statements, queries, and scripts in a
worksheet.
• About Database Actions (SQL Developer Web)
Database Actions provides a web-based interface with development, data tools,
administration, monitoring, and download features for Autonomous Database.
• Access Database Actions as ADMIN
Database Actions (also known as SQL Developer Web) is bundled with each
Autonomous Database instance.
• Provide Database Actions Access to Database Users
The ADMIN user provides access to Database Actions for other database users.
• Required Roles to Access Tools from Database Actions
Lists the database roles required to use the built-in Autonomous Database tools.
• 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.

About Database Actions (SQL Developer Web)


Database Actions provides a web-based interface with development, data tools,
administration, monitoring, and download features for Autonomous Database.
The following table lists the main features of Database Actions. Database Actions on your
Autonomous Database instance may include additional cards if you download applications
from Oracle Cloud Marketplace.

3-53

You might also like