The title summarizes my problem, I think. I'd appreciate any pointers anybody might have on what else I could try. I've pasted the console output with comments in bold below. Theinstalled version of MonetDB.R is the latest from R-forge (0.8.5).
fabians@wap27:~$ R
[...]
> library(MonetDB.R)
Loading required package: DBI
Loading required package: digest
Attaching package: ‘MonetDB.R’
The following objects are masked from ‘package:stats’:
sd, var
The following objects are masked from ‘package:base’:
sample, tabulate
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] MonetDB.R_0.8.5 digest_0.6.3 DBI_0.2-7
>
> # as @ https://github.com/ajdamico/usgsd/tree/master/MonetDB:
> batfile <- monetdb.server.setup(
+ database.directory = "~/monetdb",
+ monetdb.program.path = "/usr",
+ dbname = "test",
+ dbport = 50000L)
/home/fabians/monetdb did not exist. now it does
seems to have worked...
>
> batfile <- "/home/fabians/monetdb/test.sh"
> system(paste("cat ", batfile))
#!/bin/sh
/usr/bin/mserver5 --set prefix=/usr --set exec_prefix=/usr --dbpath /home/fabians/monetdb/test --set mapi_port=50000 --daemon yes > /dev/null &
echo $! > /home/fabians/monetdb/mserver5.started.from.R.pid
Can anybody tell me whether that shell script looks like it's supposed to?
> system(paste("ls ~/monetdb"))
test test.sh
OK, so an (empty) 'test'-directory was created along with the .sh
> monetpid <- monetdb.server.start(batfile)
Read 1 item
> system(paste("ls ~/monetdb/test"))
00e3bc31-ca59-43e6-ace8-a96aac37bddd bat box
Now after starting the monetdb server the test directory contains the data base info, I guess?
> dbname <- "test"
> dbport <- 50000L
> monet.url <- paste0("monetdb://localhost/", dbname)
> db <- dbConnect( MonetDB.R(), monet.url,
+ port=as.integer(dbport), timeout=as.integer(86400))
Error in .monetAuthenticate(socket, dbname, user, password) :
Authentication error: !monetdbd: no such database 'test', please create it first
What could be the reason that the test-directory is not found?
Slightly different command, as in the help for monetdb.server.start
and also at https://github.com/ajdamico/usgsd/tree/master/MonetDB
:
> monet.url <- paste0("monetdb://localhost:", dbport, "/", dbname)
> db <- dbConnect( MonetDB.R(), monet.url, wait = TRUE )
R: mapi.c:72: mapiConnect: Assertion `Rf_isInteger(port)' failed.
Aborted
This bug is supposed to have been fixed, see here ...
The reason for the error is that you have monetdbd still running on port 50000, which is why the mserver5 process spawned by monetdb.server.start cannot bind to it. So either choose a different port in monetdb.server.setup (e.g. 50001) or kill monetdbd before calling monetdb.server.start. Perhaps we could add a check to monetdb.server.setup to make sure no process is listening on the specified port...