The
connect
function opens a connection to a database of
database-type
. The default value for
database-type
is
*default-database-type*
. The
connection-spec
depends on the type of the database to connect to. For databases of type
:odbc
, the connection specification is a string of the format
"
datasource-name
/
username
/
password
"
where datasource-name is the name of an ODBC datasource, and username and password are a valid username and password. If the datasource does not require a username and password they can be omitted.
The variable
*default-database*
is set to an instance of the database opened and the instance is returned. The argument
if-exists
modifies the behavior of
connect
as follows:
Makes a new connection even if connections to the same database already exist.
Makes a new connection but warns about existing connections.
Makes a new connection but signals an error for existing connections.
Selects old connection if one exists (and warns) or makes a new one.
Selects old connection if one exists or makes a new one.
The following example connects LispWorks to the
info
database.
(connect "info")
The next example connects to the ODBC database
personnel
using the username "admin" and the password "secret".
(connect "personnel/admin/secret" :database-type :odbc)