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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:05:25+00:00 2026-06-18T01:05:25+00:00

I have a piece of code which access an SQLite database, which works perfectly

  • 0

I have a piece of code which access an SQLite database, which works perfectly up until Jelly Bean. In which case not all data is taken from the database ( at least the first column is omitted somehow)
And also gives the error “unknown error (code 14) could not open database”, although some data IS being read from it.
Do ask for more details if you don’t get the situation

Thank you!

private class DataBaseHelper extends SQLiteOpenHelper {

    private SQLiteDatabase myDataBase;

    public DataBaseHelper() {

        super(myContext, DB_NAME, null, 1);

        DB_PATH = "/data/data/" + myContext.getPackageName()
                + "/databases/";
    }

    /**
     * Creates a empty database on the system and rewrites it with your own
     * database.
     * */
    public void createDataBase() throws IOException {
        boolean dbExist = checkDataBase();
        if (dbExist) {

            // do nothing - database already exist
        } else {
            // By calling this method and empty database will be created
            // into the default system path
            // of your application so we are gonna be able to overwrite that
            // database with our database.
            this.getReadableDatabase();
            try {
                copyDataBase();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }


    private boolean checkDataBase() {

        SQLiteDatabase checkDB = null;

        try {
            String myPath = myContext.getDatabasePath(DB_NAME).getAbsolutePath();
            checkDB = SQLiteDatabase.openDatabase(myPath, null,
                    SQLiteDatabase.NO_LOCALIZED_COLLATORS);

        } catch (SQLiteException e) {
            // database does't exist yet.
        }

        if (checkDB != null) {
            checkDB.close();
        }

        return checkDB != null ? true : false;
    }

    /**
     * Copies your database from your local assets-folder to the just
     * created empty database in the system folder, from where it can be
     * accessed and handled. This is done by transfering bytestream.
     * */
    private void copyDataBase() throws IOException {

        // Open your local db as the input stream
        InputStream myInput = myContext.getAssets().open(DB_NAME);

        // Path to the just created empty db
        String outFileName = DB_PATH + DB_NAME;

        // Open the empty db as the output stream
        OutputStream myOutput = new FileOutputStream(outFileName);

        // transfer bytes from the inputfile to the outputfile
        byte[] buffer = new byte[1024];
        int length;
        while ((length = myInput.read(buffer)) > 0) {
            myOutput.write(buffer, 0, length);
        }

        // Close the streams
        myOutput.flush();
        myOutput.close();
        myInput.close();

    }

    public void openDataBase() throws SQLException {

        // Open the database
        String myPath =DB_PATH + DB_NAME;
        myDataBase = SQLiteDatabase.openDatabase(myPath, null,
                SQLiteDatabase.NO_LOCALIZED_COLLATORS);

    }

Here is the LogCat error

     01-11 14:36:32.153: E/SQLiteLog(15050): (14) cannot open file at line 30174 of [00bb9c9ce4]
     01-11 14:36:32.153: E/SQLiteLog(15050): (14) os_unix.c:30174: (2)        open(/data/data/eu.isdc.cabinCrew/databases/database.sqlite) - 
     01-11 14:36:32.183: E/SQLiteDatabase(15050): Failed to open database '/data/data/eu.isdc.cabinCrew/databases/database.sqlite'.
     01-11 14:36:32.183: E/SQLiteDatabase(15050): android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not   open database
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:209)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:669)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at eu.isdc.cabinCrew.a.b.c(Unknown Source)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at eu.isdc.cabinCrew.a.b.a(Unknown Source)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at eu.isdc.cabinCrew.a.a.<init>(Unknown Source)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at eu.isdc.cabinCrew.a.a.a(Unknown       Source)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at eu.isdc.cabinCrew.activities.TrainingActivity.onCreate(Unknown Source)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.app.Activity.performCreate(Activity.java:5008)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.app.ActivityThread.access$600(ActivityThread.java:130)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.os.Handler.dispatchMessage(Handler.java:99)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.os.Looper.loop(Looper.java:137)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at android.app.ActivityThread.main(ActivityThread.java:4745)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at java.lang.reflect.Method.invokeNative(Native Method)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at java.lang.reflect.Method.invoke(Method.java:511)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
     01-11 14:36:32.183: E/SQLiteDatabase(15050):   at dalvik.system.NativeStart.main(Native Method)
     01-11 14:36:32.503: E/SQLiteLog(15050): (1) no such table: airdata

It does open the database, but doesn’t find that particular table, even if it’s there. And this happens only with Jelly Bean. Did anything change with database interaction with this version?

  • 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-18T01:05:27+00:00Added an answer on June 18, 2026 at 1:05 am

    This issue is kind of fixed, it still persists but I found that the real problem was lying with showing the data on the UI with an Auto-fit TextView adapter, which didn’t work on jelly Bean.
    So I still get the ‘Failed to open database’ exception, but it works anyway, the databse is read.

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

Sidebar

Related Questions

I have the following piece of code which is not running as I expected:
I have a piece of code that works in a background process which looks
I have this piece of code which check the last customer_id from the db.
I have this piece of code which I'm hoping will be able to tell
I have a piece of code which returns a Sales Order from AX. In
Possible Duplicate: php loop through associative arrays i have this piece of code which
I am somewhat new to R, and i have this piece of code which
I have the following piece of code which outputs a long article: <?php the_content();
I have created a piece of code which takes an IP address (from main
Ok i have this piece of code from which i took from W3schools :-

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.