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

  • Home
  • SEARCH
  • 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 6774777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:49:41+00:00 2026-05-26T15:49:41+00:00

I actually seem to have problem with this (only on linux, described here with

  • 0

I actually seem to have problem with this (only on linux, described here with stacktrace like

==11682==    at 0x0: ??? // Here goes the error=(
==11682==    by 0x4D49BE: sqlite3_free (sqlite3.c:18155)
==11682==    by 0x102242D5: sqlite3OsInit (sqlite3.c:14162)
==11682==    by 0x1029EB28: sqlite3_initialize (sqlite3.c:107299)
==11682==    by 0x102A159F: openDatabase (sqlite3.c:108909)
==11682==    by 0x102A1B29: sqlite3_open (sqlite3.c:109156)
==11682==    by 0x1021CAB0: sqlite3pp::database::connect(char const*) (sqlite3pp.cpp:89)
==11682==    by 0x1021C6E3: sqlite3pp::database::database(char const*) (sqlite3pp.cpp:74)

) so I have one thread that calls 2 similar functions of 2 difrent classes using sqlitecpp

Functions look like this

void user_control::start_work_with_db( std::string db_name )
{
    if (!is_db_set) // TODO: find out how to detach from one db and connect to another.
    {
        boost::shared_ptr<sqlite3pp::database> db_( new sqlite3pp::database(db_name.c_str())); //I could not get `db = new sqlite3pp::database(DB_name.c_str());` to compile
        db = db_;
        *lu << "Connected to "<< db_name << " database and created a table with SQLite return code: " << db->execute(command_create_users_table.c_str()) << log_util::endl;
    }
}

and

void users_files_service::create_files_table( std::string db_name )
{
    if(!is_db_set) // TODO: find out how to detach from one db and connect to another.
    {
        boost::shared_ptr<sqlite3pp::database> db_( new sqlite3pp::database(db_name.c_str())); //I could not get `db = new sqlite3pp::database(DB_name.c_str());` to compile
        db = db_;
        *lu << "Connected to "<< db_name << " database and created a table with SQLite return code: " << db->execute(command_create_files_table.c_str()) << log_util::endl;
        is_db_set = true;
    }
}

and command_create_files_table looks like

command_create_files_table = "CREATE TABLE IF NOT EXISTS files (encoded_url varchar(300) UNIQUE NOT NULL primary key, file_name varchar(150) NOT NULL, user_name varchar(65) NOT NULL, is_public BOOLEAN NOT NULL, modified DATETIME NOT NULL default CURRENT_TIMESTAMP )";

and

command_create_users_table = "CREATE TABLE IF NOT EXISTS users (email varchar(100) UNIQUE NOT NULL primary key, pass varchar(100))";

and db is private member of each of classes.

I wonder – do I have an error somewhere in presented code or SQLite does not suppor operating on 2 DB files from one thread?

  • 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-05-26T15:49:42+00:00Added an answer on May 26, 2026 at 3:49 pm

    The base SQLite library most certainly supports opening multiple DB files from the same thread – I have repeatedly done so on both Linux and Windows. It is both possible and useful, as long as you do not twist yourself up by opening the same DB file twice and trying to interleave transactions, in which case your thread may just deadlock – not crash.

    This line is indicative of stack corruption:

    ==11682==    at 0x0: ???
    

    You might want to use Valgrind to further track this issue down. There are a few tips for using Valgrind in this past answer of mine.

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

Sidebar

Related Questions

Okay, Now admittedly this sounds like a silly question; But, I actually have a
I've looked at every question so far and none seem to actually answer this
Actually, this question seems to have two parts: How to implement pattern matching? How
Actually, I'm using this way. Do you have a better way? private bool AcceptJson(HttpRequest
I've got a real problem here. I have a page at: [page removed] and
This may initially seem generic, but in fact, I am actually making the decision
I have a chained XSLT 2.0 transformation scenario (using saxon), like this: - I1.xml
After years of ASP.NET development I'm actually quite surprised that I can't seem to
Actually here is a similar topic with little practical value. As far as I
Actually my question is all in the title. Anyway: I have a class and

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.