2

I am working on an android app with DB operations. And for debugging purpose I have installed the SQLite browser from here enter link description here. My problem is that when I export my db file from the emulator and open it in the browser it only shows meta data but not my actual app data.enter image description here

And yes I have exported the db file from correct location using the Android Device Manager.enter image description here

And as you can see there are some other files also created in the database folder(journal & .file). So I was wondering if anybody knows if there is any change in how the data is stored in the SQLite DB recently. I am using Android Studio 3.0.1.

Thanks in advance for the help.

Here is the new screenshot with the package name.enter image description here

Logs from the Common SQLite utility

D/SQLITE_CSU: logCursorColumns invoked. Cursor has the following 4 columns.

D/SQLITE_CSU: Column Name 1 is id

D/SQLITE_CSU: Column Name 2 is title

D/SQLITE_CSU: Column Name 3 is uid

D/SQLITE_CSU: Column Name 4 is address

D/SQLITE_CSU: logCursorData Cursor has 1 rows with 4 columns.

D/SQLITE_CSU: Information for row 1 offset=0
                For Column id Type is INTEGER value as String is 1 value as long is 1 value as double is 1.0

                For Column title Type is STRING value as String is BBC value as long is 0 value as double is 0.0

                For Column uid Type is STRING value as String is PajUFVIZvKbNWAHAgdJ9xpf6gi33 value as long is 0 value as double is 0.0

                For Column address Type is STRING value as String is http://feeds.bbci.co.uk/news/world/rss.xml value as long is 0 value as double is 0.0

Here is the logDatabaseInfo log "-

D/SQLITE_CSU: DatabaseList Row 1 Name=main File=/data/data/com.rss.feedster.rss_feedster/databases/rssFeeds
D/SQLITE_CSU: Database Version = 3
D/SQLITE_CSU: Table Name = android_metadata Created Using = CREATE TABLE android_metadata (locale TEXT)
D/SQLITE_CSU: Table = android_metadata ColumnName = locale ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table Name = feeds Created Using = CREATE TABLE feeds(id INTEGER PRIMARY KEY,title TEXT,uid TEXT,address TEXT)
D/SQLITE_CSU: Table = feeds ColumnName = id ColumnType = INTEGER Default Value = null PRIMARY KEY SEQUENCE = 1
D/SQLITE_CSU: Table = feeds ColumnName = title ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = feeds ColumnName = uid ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = feeds ColumnName = address ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table Name = user_info Created Using = CREATE TABLE user_info(id INTEGER PRIMARY KEY,uid TEXT,nickname TEXT,email TEXT,age TEXT,mobile TEXT,password TEXT,gender TEXT,photoURL TEXT)
D/SQLITE_CSU: Table = user_info ColumnName = id ColumnType = INTEGER Default Value = null PRIMARY KEY SEQUENCE = 1
D/SQLITE_CSU: Table = user_info ColumnName = uid ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = user_info ColumnName = nickname ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = user_info ColumnName = email ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = user_info ColumnName = age ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = user_info ColumnName = mobile ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = user_info ColumnName = password ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = user_info ColumnName = gender ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
D/SQLITE_CSU: Table = user_info ColumnName = photoURL ColumnType = TEXT Default Value = null PRIMARY KEY SEQUENCE = 0
MikeT
  • 51,415
  • 16
  • 49
  • 68
dissect tech
  • 35
  • 1
  • 1
  • 7
  • From what you show there is a table, namely the **Messages** table in the database. Clicking the **Browse Data** tab and then selecting the Messages table from the drop down selector will show if there is any data in that table. The journal file is SQLite's roll back file for the DB. – MikeT Mar 15 '18 at 08:45
  • Switch to `Browser data` tab to preview the data, please. – Itachi Mar 15 '18 at 08:49

1 Answers1

3

I believe that you are just looking in the wrong place, clicking the Browse Data Tab and then selecting the Messages table will show if there is any data.

The reasoning is that you are looking at the Database Structure, this shows you the tables and the SQL that will/was used to create them and additionally the columns and the SQL for the column definitions.

Having the table named android_metadata very likely shows that the database has come from and Android device rather than from another source i.e. you only find it on Android devices.

Your screenshot shows that there is a table called Messages, this isn't auto-generated nor is it created by SQLite. It has at least two columns according to the screenshot. One is named type and has a defined column-type of INTEGER along with a NOT NULL constraint the other column is named entry and has a column_type of BLOB.

Here's a similar DB that's been copied from an emulator showing how this (populated with 1 row) appears when you look at the Database Structure (Friends is the table and the columns have been expanded).

enter image description here

Note that the Browse Data table has been highlighted and has an arrow pointing to it. Clicking this will show something like :-

enter image description here

This is browsing the data for the android_metadata table (just 1 row with 1 column). To the right of the highlighted table there is a dropdown click this and select the Messages table. You data will be shown e.g (obviously this is for the Friends table):-

enter image description here

  • The table has 1 row with 6 columns
    • Column _id has a value of 1
    • Column _name has a value of Test name
    • and so on

Edit regards debugging information.

It is clear that the table you intend to copy/export from your emulator is not the database that you are looking at in DB Browser for SQLite. The database you have provided information for via the utilities provided is :-

/data/data/com.rss.feedster.rss_feedster/databases/rssFeeds

As such it is that file that you want to export copy and then open in DB Browser for SQLite.

It is not google_app_measurement_local.db

I think the issue is basically that you assumed that a database must have a .db file extension. The .db (file extension) does not affect the data it's used purely to indicate the type that the file may be.

I have little doubt that if you open the file indicated above then you will see that the data and structure are as you would expect. Note to see the file select All Files to the right of the File Name input.

As an example the following shows a file exported/copied as db1.rumplestiltskin and then opened in DB Browser for SQLite :-

enter image description here

enter image description here

The Fix

In the Device Monitor Export/Copy/Save the file /data/data/com.rss.feedster.rss_feedster/databases/rssFeeds and then open that in DB Browser for SQLite; noting that if it does not have a .db or .sqlite file extension then you will have to select All Files from the File Type selector to the right of the File Name input in order to be able to select the file from the file browser.

Perhaps have a read of Filename extension, which explains file extenstions in greater detail.

MikeT
  • 51,415
  • 16
  • 49
  • 68
  • 1
    I have seen the "Browse Data" tab and did not find my tables there. I have not created that messages table as well. Anyhow thanks for your effort. – dissect tech Mar 15 '18 at 11:11
  • @dissecttech So I suspect that your database name is not rssFeeds. If it is then you perhaps need to worry how this phantom Messages table is getting created. I'd suggest editing your question to include the database name and also the package name as it would appear that you may well be looking in the wrong place for the actual database itself. – MikeT Mar 15 '18 at 20:13
  • Actually, if you see I have not opened the "rssFeeds" file as it is of (.File) extension, I have opened the "google_app_measurement_local.db" file. And my package name is "com.rss.feedster.rss_feedster". I am attaching the new screen shot. – dissect tech Mar 16 '18 at 13:50
  • Same still applies where did the Messages table come from. However, it may simply be that there is no issue with the export but the real issue is that your there is no data to export. Perhaps have a look at/use the utilitites as per [Are there any methods that assist with resolving common SQLite issues? ](https://stackoverflow.com/questions/46642269/are-there-any-methods-that-assist-with-resolving-common-sqlite-issues) – MikeT Mar 16 '18 at 19:03
  • I am able to see the data using the utility you have provided in the above comment. And I have updated the question with its log. Please check it.. – dissect tech Mar 17 '18 at 09:51
  • Ok there is data in that table (is it as expected?). Could you also include the output from the `logDatabaseInfo` method (code from the additional post to the answer as that was added (*too much to add to the answer*)). – MikeT Mar 17 '18 at 11:48
  • Hey, I have attached the link to the log you have asked. Hope you have everything you needed. Thanks! – dissect tech Mar 18 '18 at 12:29
  • Yep it worked. And I think they have changed the format of the db to .file. I didnt even need to change the extension, just opened as it was. – dissect tech Mar 19 '18 at 07:34