Connect to Autonomous AI Database on Dedicated Exadata Infrastructure with Oracle SQLcl
Tip: For a “try it out” alternative that demonstrates these instructions, run Task 4: Connect to your autonomous DB using SQL Worksheets from Database Actions, SQLCL and SQL Plus from Lab 2: Configure a Development System in the Oracle Autonomous AI Database Dedicated Workshop.
SQLcl (Oracle SQL Developer Command Line) is a command-line interface for Oracle Database. It allows you to interactively or batch execute SQL and PL/SQL. SQLcl provides in-line editing, statement completion, and command recall for a feature-rich experience, all while also supporting your previously written SQL*Plus scripts.
To be able to connect SQLCl to an Autonomous AI Database, the system running SQLCl must have network access to the Autonomous AI Database. This can be achieved using either of the following ways:
-
By setting proper network routes with VPN (Fast connect or VPN as a Service) or any VCN peering if the compute host is in another VCN.
You can use SQLcl version 4.2 or later with Autonomous AI Database. Download SQLcl from oracle.com.
SQLcl can connect to an Autonomous AI Database using either an Oracle Call Interface (OCI) or a JDBC thin connection.
-
If you use Oracle Call Interface (OCI), start by following the instructions in Prepare for ODBC and JDBC Oracle Call Interface (OCI) Connections.
-
If you use JDBC Thin, start by following the instructions in 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 19.1 Production on Mon Jan 18 09:28:38 2021
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Username? (''?) sales_trans@atpc1_low
Password? (**********?) **************
Last Successful login time: Mon Jan 17 2019 15:29:19 -07:00
Connected to:
Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production
Version 19.9.0.0.0
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 Autonomous AI Database.
-
Start SQLcl with the /nolog option.
sql /nolog -
Configure the SQLcl session to use your Oracle Wallet:
SQL> set cloudconfig directory/client_credentials.zip Wallet Password: ********** -
Connect to the Autonomous AI Database:
SQL> connect username@servicename passwordFor example:
sql /nolog SQLcl: Release 19.1 Production on Mon Jan 18 09:28:38 2021 Copyright (c) 1982, 2021, Oracle. All rights reserved. SQL> set cloudconfig /home/atpc/wallet_ATPC.zip Operation is successfully completed. Operation is successfully completed. Using temp directory:/tmp/oracle_cloud_config3643858537577169472 SQL> connect admin@atpc_medium Password? (**********?) ************ Connected.
For more information, on the connection types specified in tnsnames.ora, see Predefined Database Service Names for Autonomous AI Databases.
For information on SQLcl, see Oracle SQLcl.
Related Content
About Connecting to Autonomous AI Database on Dedicated Exadata Infrastructure