The connection manager is a tool built into SQLcl to manage connections (as the name would imply). We can use conmgr or cm if we want to save some typing. First let’s validate that there are no configured connections.

SQL> cm list
.
SQL> 

Let’s create our first connection. Interestingly, this is not done with conmgr, but with the con[nect] command with appropriate flags. It’s worth noting that the connection details (name, connect string and redacted password) are displayed, this doesn’t happen when simply connecting without saving. If you don’t specify the -savepwd flag, then you will have to re-enter the password every time you use the connection.

SQL> conn -save tom -savepwd tom/tom@localhost:1521/orclpdb1
Name: tom
Connect String: localhost:1521/orclpdb1
User: tom
Password: ******
Connected.
SQL> 

The cm list subcommand now shows our newly added connection.

SQL> cm list
.
└── tom
SQL> 

If we want to show details of the connection we use cm show subcommand:

SQL> cm show tom
Name: tom
Connect String: localhost:1521/orclpdb1
User: tom
Password: ******
SQL> 
SQL> cm test tom
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Connection Test Successful
SQL> 

Now within SQLcl if we want to connect with that defined connection we can do so with the -name flag for the connect command.

SQL> conn -name tom
Connected.
SQL>

Even better, you can use the -name flag when launching SQLcl to connect directly using this saved connection.

  ~ sql -name tom


SQLcl: Release 25.1 Production on Wed Apr 23 16:13:25 2025

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

Last Successful login time: Wed Apr 23 2025 16:13:26 +01:00

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

SQL>

How do we modify details about the connection? Let’s update the password.

SQL> alter user tom identified by tommy;

User TOM altered.
SQL>

To update the saved connection, we use the -save and -savepwd flags for the conn command, but use the -replace command to overwrite the connection with the new details.

SQL> conn -save tom -replace -savepwd tom/tommy@localhost:1521/orclpdb1
Name: tom
Connect String: localhost:1521/orclpdb1
User: tom
Password: ******
Connected.
SQL> cm list
.
├── tom
└── tom
SQL>

Unfortunately there is currently a bug where the -replace flag doesn’t work, so we end up with two connections. Fortunately, a new command allows us to delete connections, so to finish off let’s delete them (both).

SQL> cm delete -conn tom
Connection tom has been deleted
SQL> cm list
.
└── tom
SQL> cm delete -conn tom
Connection tom has been deleted
SQL> cm list
.
SQL>