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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:11:45+00:00 2026-05-20T21:11:45+00:00

A few days ago i was experiencing an error which was caused by a

  • 0

A few days ago i was experiencing an error which was caused by a call to db.close() inside the onCreate() method.

Some more people had similar problems and this was solved here: Cannot create Android SQLite database: PRAGMA error

I am now really interested in WHY this is happening. I searched some time in the android sources but i couldn’t find the spot where the onCreate() method is called or any documentation about this to find out what happens to the SQLiteDatabase object in the surrounding code of the call to onCreate().

Does anyone knows more about this? Or knows where to read to get to know more about this? 🙂

  • 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-20T21:11:46+00:00Added an answer on May 20, 2026 at 9:11 pm

    Finally i found a code snippet which explains what i was experiencing:

    int version = db.getVersion();
            if (version != mNewVersion) {
                db.beginTransaction();
                try {
                    if (version == 0) {
                        onCreate(db);
                    } else {
                        onUpgrade(db, version, mNewVersion);
                    }
                    db.setVersion(mNewVersion);
                    db.setTransactionSuccessful();
                } finally {
                    db.endTransaction();
                }
            }
    
            onOpen(db);
            success = true;
            return db;
    

    this is one code snippet out of the android sources. And you can see from it, that there are many things happen aroung onCreate() and onUpgrade(). So everything is managed by the surrounding code. You (kind of weird talking to myself….) only have to care about doing your DATA related stuff on the db. Creation, Transaction, and closing is handled by the code surrounding it.

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

Sidebar

Related Questions

A few days ago I posted some code like this: StreamWriter writer = new
I've posted the same question here a few days ago( Java reading standard output
Few days ago I watched a BDD screencast by Rob Conery . In the
few days ago i asked about how to get all running processes in the
Few days ago all was ok: when I started my web-site with Silverlight 4.0
few days ago I asked here about implementing USB. Now, If I may, would
A few days ago, I asked why its not possible to store binary data,
A few days ago, there were a couple questions on buffer overflow vulnerabilities (such
A few days ago, I wrote about issues with implementing a ListView in ASP.NET.
A few days ago VS 2010 went in Beta test and usually with new

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.