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

The Archive Base Latest Questions

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

While using sqlcipher in Android 2.3.3. I am getting error. Here is my DB.java

  • 0

While using sqlcipher in Android 2.3.3. I am getting error.

Here is my DB.java class

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import net.sqlcipher.database.SQLiteDatabase;
import net.sqlcipher.database.SQLiteDatabase.CursorFactory;
import net.sqlcipher.database.SQLiteOpenHelper;

public class DB {

private static String _DB_NAME = "mydatabase.db";
private static int _DB_VERSION = 1;

private Context _context;
private DBHelper _helper;

public DB(Context context) {
SQLiteDatabase.loadLibs(context);
this._context = context;
this._helper = new DBHelper(this._context, _DB_NAME, null, _DB_VERSION);
SQLiteDatabase sqdb = this._helper.getWritableDatabase("123");
sqdb.close();
}

public void insertValuesInTable() {

try {
SQLiteDatabase sqdb = SQLiteDatabase.openOrCreateDatabase(_DB_NAME, "123",null);
sqdb.execSQL("insert into mytable(category, total) values (1,"100");");
sqdb.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private static class DBHelper extends SQLiteOpenHelper {

        public DBHelper(Context context, String name, CursorFactory factory,
                int version) {

            super(context, name, factory, version);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {

            createTables(db);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        }

        private void createTables(SQLiteDatabase db) {

            try {
                String query1;

                query1 = "Create table if not exists mytable (category integer primary key, total text) ;   ";
                db.execSQL(query1);

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }


}

I create the object of DB.java and make use of it like this

DB _db = new DB(getApplicationContext());
_db.insertValuesInTable();

As soon as i execute this line _db.insertValuesInTable(); I get this error

sqlite returned: error code = 14, msg = cannot open file at line 32288 of [6d326d44fd]
sqlite returned: error code = 14, msg = os_unix.c:32288: (2) open(//mydatabase.db) - 
sqlite3_open_v2("mydatabase.db", &handle, 6, NULL) failed
net.sqlcipher.database.SQLiteException: unable to open database file
net.sqlcipher.database.SQLiteDatabase.dbopen(Native Method)
net.sqlcipher.database.SQLiteDatabase.<init>(SQLiteDatabase.java:1952)
net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:902)
net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:945)
com.keane.database.DB.insertValuesInMd5Check(DB.java:133)
com.keane.test2.UsageMonitorTestActivity.onCreate(UsageMonitorTestActivity.java:45)
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
android.app.ActivityThread.access$1500(ActivityThread.java:117)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:123)
android.app.ActivityThread.main(ActivityThread.java:3683)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:507)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
dalvik.system.NativeStart.main(Native Method)

I have properly included all the .so ,.jar & .zip files. Still i am getting this error.How to solve 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-06-08T11:01:16+00:00Added an answer on June 8, 2026 at 11:01 am

    You should create a subclass of android.app.Application, and register it within your AndroidManifest.xml file. Before you call SQLiteDatabase.openOrCreateDatabase, get the full path to the database file by calling getDatabasePath from your application instance and pass that value to SQLiteDatabase.openOrCreateDatabase.

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

Sidebar

Related Questions

while using tiles along with spring i m getting following error: java.net.UnknownHostException: tiles.apache.org program
While using sqlite database in android I am getting a weird problem. I am
While using inner join on Pro*C I am getting the below error: PCC-S-02201, Encountered
while using document cookie <script typ=text/javascript> document.domain=example.com; </script> I got an error.i don't know
While using Java's switch case, it excepts only char and int, but I want
While using container managed entity bean when is the bean stored to database by
While using the Nimbus L&F feel in Java, I am having problems with changing
While using tar->write() I am getting errors while using complex file names. The code
While using xmlstarlet on web pages, I most of time faced entity reference error.
While using this line of code, I get the error CS1040: Preprocessor directives must

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.