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 8679561
In Process

The Archive Base Latest Questions

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

I created in-memory database in Android. I put null in name parameter in SQLiteOpenHelper

  • 0

I created in-memory database in Android. I put null in name parameter in SQLiteOpenHelper constructor:

SQLiteOpenHelper(context, null, null, 1);

Also I created some doc_orders_products table in the in-memory db.

Now I’m trying attach this in-memory db to my main on-disk db.
What name of in-memory db should I use in ATTACH command?

I tried:

mainDB.execSQL("ATTACH DATABASE ':memory:' AS temp_db");

and

mainDB.execSQL("ATTACH DATABASE '' AS temp_db");

Both ATTACH command performs well even when in-memory db isn’t created at all.
But when I try get access to tables in the in-memory db, they are not present. I get exception. E.g.:

10-11 14:07:46.782: E/AndroidRuntime(2107): Caused by: 
android.database.sqlite.SQLiteException: no such table: 
temp_db.doc_orders_products (code 1): , while compiling: 
INSERT INTO temp_db.doc_orders_products SELECT * FROM 
main.doc_orders_products WHERE doc_id=3

Is it possible to attach in-memory db to on-disk db? What correct way is to do it?

Thanks.

  • 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-12T21:00:10+00:00Added an answer on June 12, 2026 at 9:00 pm

    Every new connection to an in-memory database creates a new, empty database.
    So your ATTACH commands attached to a different database.

    What you should do is to use the ATTACH command and then create your tables, through the mainDB connection, in the temp_db database; e.g. CREATE TABLE temp_db.doc_orders_products(....

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

Sidebar

Related Questions

For example I have created cluster with 1GB RAM memory per node. After some
I've created many Geodata objects (name,postalCode,lat,lon). Now I want to put them into a
I've some trouble to upload file from Memory Stream to database (it's visible in
I have created an in memory database using the statement: rc = sqlite3_open(:memory:, &db);
If a create a in-memory sqlite database using syntax below, then what is the
I created an intentional memory leak to demonstrate a point to people who will
Just for fun I created a project that created about 5 GB of memory
Will p = (users *)malloc(sizeof(users)); create memory for the playlist structure too? Also how
Context: In Lua, it's trivial and very cheap (4kb of memory) to create a
I made a database through sqlite in c++. The db has been created in

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.