Create a Database

Create a Database mk Tue, 02/25/2020 - 10:22

 VOCThe MonetDB/SQL tutorial is based on the material published in the book J.R. Bruijn, F.S. Gaastra and I. Schaar, Dutch-Asiatic Shipping in the 17th and 18th Centuries, which gives an account of the trips made to the East and ships that returned safely (or wrecked on the way). A total of 8000 records are provided. They include information about ship name and type, captain, the arrival/departure of harbors along the route, personnel accounts, and anecdotal information.

The first step to use MonetDB on Linux is starting daemon monetdbd, code name meriovingian. It runs in the background and facilitates, amongst others, management of local/remote servers.  The daemon is controlled by the application monetdb. See its documentation for all details. The monetdbd is not available on Windows, but for all these systems a default database called demo is available by default (you can find the Windows tutorial here).

Every newly created database contains a system user named monetdb and system schemas such as "sys", "tmp", "profiler" and some more. To connect/login to the database server the first time, you must use monetdb as user name and enter its default password: monetdb. Once connected you may create new users, create new schemas, create tables etc. It is also strongly recommended to change the default password of the monetdb system user via ALTER USER SET PASSWORD command.

Here we demonstrate a simple session involving creation of a database, loading data, and querying.
shell> monetdbd create /path/to/mydbfarm
shell> monetdbd start /path/to/mydbfarm
shell> monetdb create voc
shell> monetdb release voc
shell> mclient -u monetdb -d voc
Welcome to mclient, the MonetDB/SQL interactive terminal (Oct2014-SP1)
Database: MonetDB v11.19.7 (Oct2014-SP1), 'mapi:monetdb://localhost:50000/voc'
Type \q to quit, \? for a list of available commands
auto commit mode: on
sql>SELECT 'hello world';
| single_value  |
| hello world   |
1 tuple (0.530ms)

The command \q or end-of-file <Ctrl-d> signal terminates the connection with the server.