SQLite Forum

In memory db actually creating file
Login
I'm using sqlite3, built from source, to create an in memory database but sqlite3 is creating a file in the working directory. Here's a simple program that I used to show the issue.

<verbatim>
#include <sqlite3.h>

int main(int argc, char** argv)
{
    sqlite3* db;
    sqlite3_open("file:memdb1?mode=memory&cache=shared", &db);
    const char* sql = "CREATE TABLE IF NOT EXISTS TEST (ID INT);"
                      "INSERT INTO TEST VALUES (1), (2);";

    sqlite3_exec(db, sql, 0, 0, 0);
    sqlite3_close(db);
    return 0;
}
</verbatim>

When I use the sqlite3 lib packaged with Ubuntu 20.04 a file is not created. Has anybody had this issue when using sqlite built from source?