I suspect Fabian is tired of these messages. We have been using MonetDB for about two years now and are very impressed.
However, issues with JDBC connections continue to plague us from time to time. We keep trying to determine exactly what the magical sequence is in respect to creating databases and connecting using merovingian that will avoid the dreaded "InvalidCredentialsException". We carefully read all mentions of merovignian locks and vaultkeys but are frequently still sometimes stuck trying to connect to a new database.
We are very grateful for this wonderful piece of technology, and would be even more grateful if we could figure out how to avoid the InvalidCredentialsException when connecting using the JDBC driver. As far as the driver is concerned we are using the driver from the same build, monetdb-1.10-jdbc.jar, identified as Magnistipula 20090424. (We have also tried the most recent driver, with no better result)
Here is a full sequence of one of the many approaches we have tried, based on Fabian's documentation at http://monetdb.cwi.nl/XQuery/Documentation/The-JDBC-Library.html
We run as monetdb:monetdb (user:group)
In summary, make sure user monetdb has permissions on the necessary commands and on the dbarm, then
1. switch to user monetdb
2. start merovingian
3. create database
4. connect to merovignian
This fails, here is the gory detail:
# what version are we running, built from MonetDB-Feb2009-SuperBall-SP1.tar.bz2
dbserver:/ # /monetdb/bin/mserver5 --version
MonetDB server v5.12.0 (64-bit), based on kernel v1.30.0 (64-bit oids)
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2009 MonetDB B.V., all rights reserved
Visit http://monetdb.cwi.nl/ for further information
Configured for prefix: /monetdb
Libraries:
libpcre: 7.2 2007-06-19 (compiled with 7.2)
openssl: OpenSSL 0.9.8e 23 Feb 2007 (compiled with OpenSSL 0.9.8e 23 Feb 2007)
libxml2: 2.6.30 (compiled with 26.30)
Compiled by: root@dbserver (x86_64-unknown-linux-gnu)
Compilation: gcc -O2 -std=c99 -fgnu89-inline
Linking : ld -IPA -m elf_x86_64
# start from a fresh install, let's make sure the dbfarm is clean
dbserver:/ # ls -l -r /monetdb/var/MonetDB5/dbfarm/
total 0
# let's make sure merovingian is not running
dbserver:/ # netstat -tlnp | grep mero
# let's see who owns the dbfarm, it is monetdb:monetdb
dbserver:/ # ls -l -r /monetdb/var/MonetDB5
total 4
drwxrwxrwx 2 monetdb monetdb 4096 2009-07-15 23:40 dbfarm
# so we switch to monetdb
dbserver:/ # su monetdb
# who are we, just to be sure
monetdb@dbserver:/> id
uid=1015(monetdb) gid=1099(monetdb) groups=1099(monetdb)
# Fabian says start merovingian
monetdb@dbserver:/> /monetdb/bin/merovingian
# is merovignian running - we set its port to 50050 in monetdb5.conf
monetdb@dbserver:/> netstat -tlnp | grep mero
tcp 0 0 0.0.0.0:50050 0.0.0.0:* LISTEN 9588/merovingian
# Fabian says create a database with monetdb
monetdb@dbserver:/> /monetdb/bin/monetdb create TEST
successfully created database 'TEST'
# we have downloaded the jdbcclient.jar from the same build (SP1), let's try and connect
monetdb@dbserver:/> java -jar /monetdb/jdbcclient.jar -umonetdb -hlocalhost -p50050 -dTEST
password:
Database connect failed: InvalidCredentialsException:checkCredentials:invalid credentials for user 'monetdb'
monetdb@dbserver:/>
# not so good, let's try mclient to see what happens with a similar request
monetdb@dbserver:/> /monetdb/bin/mclient -umonetdb -lsql -hlocalhost -p50050 -dTEST
Password:
sql>
# looks more promising, who are the users
sql>SELECT * FROM USERS;
+---------+---------------+----------------+
| name | fullname | default_schema |
+=========+===============+================+
| monetdb | MonetDB Admin | 1061 |
+---------+---------------+----------------+
1 tuple
# what's happening on disk, merovignian has created its locks
monetdb@dbserver:/> ls -la /monetdb/var/MonetDB5/dbfarm/
total 12
drwxrwxrwx 3 monetdb monetdb 4096 2009-07-15 23:43 .
drwxrwxrwx 3 monetdb monetdb 4096 2009-05-23 18:03 ..
srwx------ 1 monetdb monetdb 0 2009-07-15 23:43 .merovingian_control
-rw------- 1 monetdb monetdb 0 2009-07-15 23:43 .merovingian_lock
drwx------ 5 monetdb monetdb 4096 2009-07-15 23:46 TEST
# and in the dbfarm there is a vaultkey
monetdb@dbserver:/> ls -la /monetdb/var/MonetDB5/dbfarm/TEST/
total 40
drwx------ 5 monetdb monetdb 4096 2009-07-15 23:46 .
drwxrwxrwx 3 monetdb monetdb 4096 2009-07-15 23:43 ..
drwx------ 8 monetdb monetdb 4096 2009-07-15 23:53 bat
drwx------ 2 monetdb monetdb 4096 2009-07-15 23:46 box
-rw------- 1 monetdb monetdb 31 2009-07-15 23:46 .conn
-rw------- 1 monetdb monetdb 56 2009-07-15 23:46 .gdk_lock
-rw------- 1 monetdb monetdb 13 2009-07-15 23:46 .scen
drwx------ 3 monetdb monetdb 4096 2009-07-15 23:46 sql_logs
-rw------- 1 monetdb monetdb 11 2009-07-15 23:46 .uplog
-rw------- 1 monetdb monetdb 48 2009-07-15 23:43 .vaultkey
monetdb@dbserver:/>
# what did the merovignian log say when we tried to connect with the jdbcclient
2009-07-15 23:43:02 MSG merovingian[9588]: Merovingian 1.0 starting ...
2009-07-15 23:43:02 MSG merovingian[9588]: monitoring dbfarm /monetdb/var/MonetDB5/dbfarm
2009-07-15 23:43:02 MSG merovingian[9588]: listening for TCP connections on dbserver:50050
2009-07-15 23:43:02 MSG merovingian[9588]: listening for UDP messages on dbserver:50050
2009-07-15 23:43:02 MSG merovingian[9588]: listening for UNIX connections on /monetdb/var/MonetDB5/dbfarm/.merovingian_control
2009-07-15 23:46:37 MSG merovingian[9588]: starting database 'TEST', up min/avg/max: 0/0/0, crash average: 0.00 0.00 0.00 (0-0=0)
2009-07-15 23:46:37 MSG TEST[9654]: executing '/monetdb/bin/mserver5' for database 'TEST'
2009-07-15 23:46:37 MSG TEST[9654]: # MonetDB server v5.12.0, based on kernel v1.30.0
2009-07-15 23:46:37 MSG TEST[9654]: # Serving database 'TEST', using 1 thread
2009-07-15 23:46:37 MSG TEST[9654]: # Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked
2009-07-15 23:46:37 MSG TEST[9654]: # Copyright (c) 1993-July 2008 CWI.
2009-07-15 23:46:37 MSG TEST[9654]: # Copyright (c) August 2008-2009 MonetDB B.V., all rights reserved
2009-07-15 23:46:37 MSG TEST[9654]: # Visit http://monetdb.cwi.nl/ for further information
2009-07-15 23:46:37 MSG TEST[9654]: # Listening for connection requests on mapi:monetdb://dbserver:50000/
2009-07-15 23:46:38 MSG merovingian[9588]: proxying client 127.0.0.1:55131 for database 'TEST' to mapi:monetdb://dbserver:50000/
2009-07-15 23:46:38 MSG merovingian[9588]: client 127.0.0.1:55131 has disconnected from proxy