I create a table in sqlite database I am doing all the CRUD operation but I want to see my database schema . I try through DDMS tool of eclipse IDE but there is no database. How can I see my database.i am using real device. Please Help me. Thanks in advance
-
You make sure to choose the right emulator or real device in DDMS ? – Iris Louis Jul 12 '16 at 04:09
-
i am using real device – Mss iOS Jul 12 '16 at 04:11
-
I think can't. If you want, you can try root your device – Iris Louis Jul 12 '16 at 04:13
-
You can download [Genymotion](https://www.genymotion.com) to test. – Iris Louis Jul 12 '16 at 04:15
-
can i check without rooting the device – Mss iOS Jul 12 '16 at 04:16
-
I think can't if your device don't root. Because OS don't accept it. – Iris Louis Jul 12 '16 at 04:20
-
ok thanks for giveing your appriciate time.. – Mss iOS Jul 12 '16 at 04:23
3 Answers
You can use this method:
STEP 1: First export the database by writing function :
public static void backupDatabase() throws IOException {
//Open your local db as the input stream
String inFileName = "/data/data/com.myapp.main/databases/MYDB";
File dbFile = new File(inFileName);
FileInputStream fis = new FileInputStream(dbFile);
String outFileName = Environment.getExternalStorageDirectory()+"/MYDB";
//Open the empty db as the output stream
OutputStream output = new FileOutputStream(outFileName);
//transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
int length;
while ((length = fis.read(buffer))>0){
output.write(buffer, 0, length);
}
//Close the streams
output.flush();
output.close();
fis.close();
}
Taken from Stack overflow link
Then download DB Browser for SQLite and open database file there.DB Browser for SQLite
And you are good to go.Inform me if you found any difficulties while implementing this.

- 1
- 1

- 597
- 4
- 13
-
hello smit i do this for exporting work but can't understand how to see my database from db brower when i go in file explorer i expends the data folder nothing so ther what can i do. – Mss iOS Jul 12 '16 at 06:05
-
Assuming that you have successfully exported db file and opened it on Sqlite browser then just clicked on "browse data" then click on your any of the table name, and if you have any kind of data then it will be displayes here otherwise just blank filed is there. – Smit.Satodia Jul 12 '16 at 06:16
-
-
-
-
@MssiOS If you find this ans helpfull then kindly upvote and/or accept it.Thank you – Smit.Satodia Jul 12 '16 at 07:48
-
-
thanks smit i do this i can see my database structure .thanks once again – Mss iOS Jul 12 '16 at 10:12
-
-
@MssiOS There is otherkind of database exporting code available on the stackovreflow site, Without using any kind of code your device must be rooted. – Smit.Satodia Jul 12 '16 at 10:26
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/117066/discussion-between-mss-ios-and-smit-satodia). – Mss iOS Jul 12 '16 at 10:34
In a real device you cannot access the SQLite DB unless ur phone is rooted.. in a virtual device however you can access it. but there is no way u can see the actual schema. all you see is some text files and once you open them up your columns(data fields) are separated by tabs or something. so
How can I see my database? YOU CAN'T

- 744
- 11
- 25
Only rooted real device can be access using some jar in eclipse. Other wise you can seed database structure in emulator from DDMS Respective. To know how to do this. Please red this to solve your problem.

- 1
- 1