Most Proximity applications can be run either through the Proximity Database Browser or via shell scripts (Linux/Mac OS X) or batch files (Windows) that call the applications.
Proximity applications are supported by a Java API. You can use the API as you would any other Java API in your own Java applications. Proximity also provides a scripting interface that lets you access the full API functionality through Python scripts. Proximity’s scripting interface is an important mechanism for working in Proximity and is described in Chapter 6, Using Scripts.
The following sections describe how to use the MonetDB server and run Proximity applications. See Appendix A, Proximity Quick Reference for a convenient summary of this information.
Proximity uses a MonetDB database to store its data. Unlike traditional database systems that start the server separately from connecting to a database, MonetDB attaches a server to a database. To connect to multiple databases, you must start multiple copies of the server.
When you start the MonetDB server, you specify the database to serve. MonetDB stores database files in different locations, depending on your platform:
Linux and Mac OS X: /usr/local/Monet-mars/var/MonetDB4/dbfarm/
Windows: C:\\Documents and Settings\ where
username\Application Data\MonetDB4\dbfarm\username is the login name for the user
who installed MonetDB
Database names correspond to the directories immediately under
dbfarm. When you create the ProxWebKB
database in Exercise 3.1,
MonetDB creates a ProxWebKB directory under
dbfarm.
Proximity provides an MIL
(Monet Interpreter Language) script,
init-mserver.mil, that loads required modules and
makes the server start listening for connections on a given port
(30000 by default).
Full MonetDB documentation is available from CWI’s website at monetdb.cwi.nl/projects/monetdb/MonetDB/Version4/Documentation/index.html.
Starting the MonetDB server under Linux/Mac OS X
Start the MonetDB server by executing the Mserver
command,
located in /usr/local/Monet-mars/bin. You can add
this directory to PATH
as the examples in the Tutorial assume, or
specify the full path on the command line.
The command line below starts the MonetDB server the default port (30000) for a specified database, using the Proximity initialization script.
> Mserver --dbname name $PROX_HOME/resources/init-mserver.mil
where name is the name of the database to
be served.
To use a different port, add the port information to the command line as shown below:
> Mserver --dbname name $PROX_HOME/resources/init-mserver.mil --set port=nnnnn
where nnnnn is the new port number.
(Remember to use a port number > 40000 if you are using
MonetDB 4.6.2.)
MonetDB responds with a startup message:
# MonetDB Server v4.20.0 # based on GDK v1.20.0 # Copyright (c) 1993-2007, CWI. All rights reserved. # Compiled for powerpc-apple-darwin8.10.0/32bit with 32bit OIDs; dynamically linked. # Visit http://monetdb.cwi.nl/ for further information. Listening on port 30000 MonetDB>
The startup message may be slightly different depending on your operating system, the version of MonetDB you are using, and whether you elected to use the default port or specify a different port number on the command line.
If the database does not exist, the MonetDB server starts on the specified port to let you work interactively or to create new databases, but prints the following warning message:
!WARNING: GDKlockHome: created directory
/usr/local/Monet-mars/var/MonetDB4/dbfarm/name/
!WARNING: GDKlockHome: ignoring empty or invalid .gdk_lock.
!WARNING: BBPdir: initializing BBP.
where name is the name of the database.
Starting the MonetDB server under Windows
The MonetDB server is run from a command (DOS) window.
The Mserver.bat batch file is
located in your local MonetDB installation directory
(C:\Program Files\CWI\MonetDB4 if you installed
MonetDB in the default location). You can add this directory to
PATH as the examples in the
Tutorial assume, or specify the full path on
the command line.
The command line below starts the MonetDB server on the default port (30000) for a specified database, using the Proximity initialization script.
> Mserver.bat --dbname name %PROX_HOME%\resources\init-mserver.mil
where name is the name of the database to
be served.
To use a different port, add the port information to the command line as shown below:
> Mserver.bat --dbname name %PROX_HOME%\resources\init-mserver.mil \
--set port=nnnnn
where nnnnn is the new port number.
(Remember to use a port number > 40000 if you are using
MonetDB 4.6.2.)
MonetDB responds with a startup message:
# MonetDB Server v4.18.2 # Copyright (c) 1993-2007, CWI. All rights reserved. # Compiled for i686-pc-win32/32bit; dynamically linked. # Visit http://monetdb.cwi.nl/ for further information. Listening on port 30000 MonetDB>
The startup message may be slightly different depending on your operating system, the version of MonetDB you are using, and whether you elected to use the default port or specify a different port number on the command line.
If the database does not exist, the MonetDB server starts on the specified port to let you work interactively or to create new databases, but prints the following warning message:
!WARNING: GDKlockHome: created directory
C:\Documents and Settings\All Users\Application Data\MonetDB4\dbfarm\name\
!WARNING: GDKlockHome: ignoring empty or invalid .gdk_lock.
!WARNING: BBPdir: initializing BBP.
where name is the name of the database.