[plt-scheme] problem using sqlite and web server in combination (empty db file)

From: Thomas Chust (chust at web.de)
Date: Thu Jun 11 20:18:29 EDT 2009

Hello Sigrid,

I'm not sure whether you are experiencing the same problem as me here,
but at least the fact that a new empty database file shows up in an
unexpected directory suggests that you may be.

I ran into similar difficulties using SQLite3 from PLT Scheme and
after some experiments I came to the conclusion that the current
working directory as seen from PLT Scheme code is not always identical
with the current working directory of the process as seen by the
native SQLite3 code. Therefore specifying a relative path to a
database file can easily cause SQLite3 to create a new empty database
in some unexpected place. If I'm not mistaken, the value of
current-directory disagrees with what the C library's getcwd returns
as soon as the value of current-directory is parameterized.

I would suggest to circumvent the problem by simply specifying an
absolute path to the SQLite3 database.

An arguably better solution would be to adapt the code in the SQLite3
binding you are using to automatically convert paths to an absolute
form before they are passed to the native sqlite3_open call.

cu,
Thomas


Posted on the users mailing list.