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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:41:30+00:00 2026-06-09T02:41:30+00:00

I need help to use use my existing sqlite database in android. i am

  • 0

I need help to use use my existing sqlite database in android.

i am placing my sqlite database in “/assets/(mydatabase)” but unable to use it.

i am using following code.
some times it show error “unable to open database” and some times shows error like “can not find table”.
when i pull out database file from ddms and open it using sqlite browser it dropes my table means my table do not exist any more.

so please help me to get the way how i can use my existing sqlite databse in android just for read and rite operations.

private SQLiteDatabase MyDataBase;
private String path="/data/data/mypackagename/mydatabase";
try{
      MyDataBase=SQLiteDatabase.openDatabase(path, null,SQLiteDatabase.OPEN_READWRITE);
      Cursor myDbCursor;
      myDbCursor=MyDataBase.rawQuery("select user,password from login_master", null);
      String username=myDbCursor.getString(0);
      String password=myDbCursor.getString(01);
      Toast.makeText(getBaseContext(), username, 10).show();
      Toast.makeText(getBaseContext(), password, 10).show();
      MyDataBase.close();
  }
  catch(SQLiteException e){
      Toast.makeText(getBaseContext(), e.getMessage(), 10).show();
  }
  • 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-09T02:41:31+00:00Added an answer on June 9, 2026 at 2:41 am

    not sure but this can help you

    void checkDB() throws Exception {
        try {
            SQLiteDatabase dbe = SQLiteDatabase
                    .openDatabase(
                            "/data/data/yourpackagename/databases/yourfilename.sqlite",
                            null, 0);
            Log.d("opendb", "EXIST");
            dbe.close();
        } catch (Exception e) {
    
            AssetManager am = getApplicationContext().getAssets();
            OutputStream os = new FileOutputStream(
                    "/data/data/yourpackagename/databases/yourfilename.sqlite");
            byte[] b = new byte[100];
    
            int r;
            InputStream is = am.open("yourfilename.sqlite");
            while ((r = is.read(b)) != -1) {
                os.write(b, 0, r);
            }
            Log.i("DATABASE_HELPER", "Copying the database ");
            is.close();
            os.close();
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my app i use Using an existing sqlite database and i need to
I need help to use jConfirm with this existing code (php & Jquery &
I need help! I use fancybox and use iframe to show other page but
i need some help in addition to android-layouts. For eyample: Actually I use a
I need help on which random number generator to use simultaneously from multiple threads
Sorry guys for noob question, need help. I'm try to use Sharekit - https://github.com/ShareKit/ShareKit
I need some help in understanding when and why to use Remote Service instead
hy, i need a little help here: i use SWFupload to upload images! in
i need help modelling a use case diagram from a topic, it will be
I have few values existing in data base,i need to update them but,i am

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.