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.

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.
    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>

    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>

    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
    
    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.