Name

CREATE-DATABASE — create a databaseFunction

Syntax

create-database connection-spec &key database-type => success

Arguments and Values

connection-spec

A connection specification

database-type

A database type specifier, i.e. a keyword. This defaults to the value of *default-database-type*

success

A boolean flag. If T, a new database was successfully created.

Description

This function creates a database in the database system specified by database-type.

Examples

(create-database '("localhost" "new" "dent" "dent") :database-type :mysql)
=> T

(create-database '("localhost" "new" "dent" "badpasswd") :database-type :mysql)
=>
Error: While trying to access database localhost/new/dent
  using database-type MYSQL:
  Error database-create failed: mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'
  has occurred.
  [condition type: CLSQL-ACCESS-ERROR]
	

Side Effects

A database will be created on the filesystem of the host.

Exceptional Situations

An exception will be thrown if the database system does not allow new databases to be created or if database creation fails.

See Also

destroy-database
probe-database
list-databases

Notes

This function may invoke the operating systems functions. Thus, some database systems may require the administration functions to be available in the current PATH. At this time, the :mysql backend requires mysqladmin and the :postgresql backend requires createdb.

create-database is a CLSQL extension.