dissect tech
dissect tech

Reputation: 35

My db records are not showing in sqlite browser

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

Upvotes: 2

Views: 14136

Answers (1)

MikeT
MikeT

Reputation: 57043

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.

Upvotes: 3

Related Questions