20.2.5 General database connection and disconnection

Once the database type has been initialized a connection can be established by calling
connect
with an appropriate
connection-spec
. A call to
connect
sets
*default-database*
to the database instance which represents the connection. All the other database functions described take a
:database
argument that can be either a database or a database name, and which defaults to the value of
*default-database*
.

Database connections can be named by passing the
:name
argument to
connect
, allowing you to have more than one connection to a given database. If this is omitted, then a unique database name is constructed from
connection-spec
and a counter. Connection names are compared with
equalp
.

To find all the database connection instances, call the function
connected-databases
. To retrieve the
name
for a connection instance, call
database-name
, and to find a connection instance with a given name use
find-database
. To print status information about the existing connections, call
status
.