Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:36:12+00:00 2026-06-15T21:36:12+00:00

I want to create a shared, in-memory database with SQLite by passing it URI

  • 0

I want to create a shared, in-memory database with SQLite by passing it URI like file:memdb1?mode=memory&cache=shared.

The following code looks simple enough to get the job done:

#include <iostream>
#include <sqlite3.h>

void main()
{
  sqlite3 * db;
  int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_URI;
  int returnCode = sqlite3_open_v2("file:memdb1?mode=memory&cache=shared", &db, flags, NULL);

  if (returnCode == SQLITE_OK)
    std::cout << "Success!" << std::endl;
  else
    std::cout << "Error: " << sqlite3_errmsg(db) << std::endl;

  if (db) sqlite3_close(db);
}

Then I compile it like this:

$ g++ sample.cpp -lsqlite3

And this is what I get:

$ ./a.out
Error: no such access mode: memory

I have tried many different configurations for flags (some including SQLITE_OPEN_MEMORY) and I have not been able to get this simple program to run. I’ve tried it on both Windows (with a custom build of SQLite 3.7.15) and on Ubuntu (using the default apt-get package, version 3.7.9) with no success.

Has anyone encountered this and discovered a solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:36:13+00:00Added an answer on June 15, 2026 at 9:36 pm

    It turns out I was using the wrong version of SQLite. Shared caches are not supported in SQLite until version 3.7.13 (see changelog).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My application creates a in-memory database (:memory:) using sqlite as a back end. I
I want to have a shared memory block (an ashmem region) that's mapped and
Is it possible to create a memory pool shared between processes (for example from
Im trying to create counter that using shared block memory, just look code: $i=0;
I want to create an instance of a class and place it in shared
I want to insert a shared vector into a shared map using the following
I want to use shared memory to save characters printed by two parent-child process.
I'm trying to construct a map in shared memory of the following type I
I want to create a batch file that helps multiple users install numpy on
I want to share some objects between multiple programs using shared memory. I've found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.