2

I have been looking for hours now how to see my database using the program DB Browser for SQLite (http://sqlitebrowser.org/).

I downloaded the software and i can't find any file on my computer that can be opened with this software.

So what kind of file android SQLiteOpenHelper class generates? And how can i open it using the software mentioned(Or any other way i can see my database?).

I'm not using emulator. I run my app on an actual device.

EDIT So i guess i need to do this adb pull data/data/package-name/databases/database-name and i really dont know how to do it.

17
  • Why not using SQLite Debugger Commented Nov 28, 2015 at 9:01
  • @Tony Never heard of it. Just installed it.I will check it out. Commented Nov 28, 2015 at 9:02
  • 1
    Alright, make sure you root your device Commented Nov 28, 2015 at 9:03
  • @Tony My device is not rooted so i cant open it with SQLite Debugger.It says i can only open it using sd card. Commented Nov 28, 2015 at 9:03
  • 1
    Try root your device and see Commented Nov 28, 2015 at 9:04

1 Answer 1

1

In my development i encountered same issue. Your database gets saved in "/data/data/yourapp/database.db".

This is not reachable by default. You have to root your device to view this location. This is something i didn't do. Instead i saved my database in another location that is reachable by default.

public static final String database_path = Environment.getExternalStorageDirectory() + "folder name";

Then i went in the Android Device Monitor and looked at that location to find my database.

Once i found it i used SQLiteStudio to view my database and look if everything is in order.

See http://sqlitestudio.pl for more information

Does that help you out ?

Update 1

You can put your database where you like, any folder you haver permission on. Then you will have to add the path to your constructor of your helper.

public MyDatabaseHelper(Context context) {
    super(context, DATABASE_PATH + DATABASE_NAME, null, 8);
    this.myContext= context;
}

How do you get your database? You copy it or you create it programmatically?

Sign up to request clarification or add additional context in comments.

7 Comments

Where did you exactly wrote that path line of code?
In your helper class for your database. My predefined db is in the assets folder, where i copy it locally into the device at the location i want. Be sure to set in the manifest, write external storage...See developer.android.com/training/basics/data-storage/… for reference
Thanks. i will look after that tomorrow.
The `"folder name" is any folder i choose? Like to open a new folder an call it db and store it there?
I do it programmatically. i Created a folder calledUsersDb and then i wrote in the SQLiteOpenHelper class public static final String DATABASE_PATH = Environment.getExternalStorageDirectory() + "UsersDb"; and now i only need to add the path to the constructor like you wrote?
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.