why my database file in SQLite manager can not be openned? - android

I want to open my database file using "Questoid SQLite Manager". When I'm trying to do that a message says: "Select db file in File Explorer, and open it in SQLite Manager..."
As I've searched about this error, I've find that the database must have .db extension. now my database name is mydb.db and it's running on emulator.
Most of topics about this error are referring to .db extension and root permission as I've seen in these topics:
Not able to open database file in SQLite manager plugin for eclipse?
https://stackoverflow.com/questions/19177467/not-able-to-open-the-db-file-with-questoid-sqlite-manager-browser
Why I can't see DB structure by SQLite Manager in file explorer
What else I should do about it?

I had the same problem with "sqlitemanager": only .db-Database files are accepted.
This is the solution:
Download this Questoid SqLiteBrowser: http://www.java2s.com/Code/JarDownload/com.questoid/com.questoid.sqlitebrowser_1.2.0.jar.zip
Unzip and put it into eclipse/dropins (not Plugins)

You can use http://sourceforge.net/projects/sqlitebrowser to open your database file.

did you try to open it using firefox.
there is a plugin needed for it to do so
check this

Related

Android Room database pull

I use Room database to build my app.
After i create my database how i pull the database file with the following adb command:
adb exec-out run-as ---.---.--- cat /data/data/---.---.---/database/user-database.db > MyDB.db
Then when i try to oped that MyDB.db file with sqlitebrowser i see the message "Invalid file format".
Why i can not open that file?
Is there an other better way to pull and examine the database file created by Android Room ??
Thank you
In Android Studio 3, there is Device File Explorer at the right side (for me).DeviceFileExplorer photo
Click it and go to your database file. for me, data> data> myPackageName> databases> location of database file

Where is the app Personal Folder path

Im trying to create a sqlLite db. This code works and create the db and allow me do insert and select.
string dbPath = Path.Combine(
System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
"ormdemo.db3");
//dbPath = "/storage/emulated/0/DCIM/ormdemo.db3";
var db = new SQLiteConnection(dbPath);
db.CreateTable<Stock>();
Right now the dbPath returned is:
"/data/user/0/MyFirstGPSApp.MyFirstGPSApp/files/ormdemo.db3"
But when I use a sqlLite Manager to try open the db I cant find the folder /data/user
Where is that folder /data/user?
The sqlLite have the option to open "APP" databases, but when try to select MyFirstGPSApp say need a root device.
The starting folder for sqlLite is /storage/emulated/0 and have a sub folder /DCIM
So I try to use a folder I can see ... like /storage/emulated/0/DCIM/ormdemo.db3 but then the new SQLiteConnection(dbPath) give me this error.
SQLite.SQLiteException: Could not open database file: /storage/emulated/0/DCIM/ormdemo.db3 (CannotOpen)
Do I need special permision to write in /DCIM folder?
Ok, there are three questions in your post. Before answer your questions, I think some pictures are necessary.
P1:
P2:
Like #Yogesh Paliyal has said, you need File Explorer to see it. If you also want to see it and you don't want to root you device, please follow me: Visual Studio->Tools->Android->Android Device Monitor->select one simulator from Devices column->File Explorer. I suggest you create a simulator which Api is below 21, because the higher also can't see the file. I am using 19 to see the files.
And I think you should read this firstly.
Ok, let's see your questions:
Where is the app Personal Folder path?
In android, there are two folder: personal/internal folder and public/external folder, here is official document.
Personal/Internal Folder path:
/data/data/package name/shared_prefs: SharedPreferences
/data/data/package name/databases: Sqlite
/data/data/package name/files: Api:getFilesDir()
/data/data/package name/cache: Api:getCacheDir()
/storage/sdcard/Android/data/package name/files: Api:getExternalFilesDir()
/storage/sdcard/Android/data/package name/cache: Api:getExternalCacheDir()
Public/External Folder path:
In /storage/sdcard folder, only Android folder is personal/internal folder,so /storage/sdcard/DCIM, /storage/sdcard/Music,etc, all of them are public/external folder: Api:Environment.getExternalStoragePublicDirectory(String type)
Where is that folder /data/user?
From P1, you can see the ->/data/data/ is behind of /data/user/0, so the folder /data/user/0/MyFirstGPSApp.MyFirstGPSApp/files/ormdemo.db3 is /data/data/MyFirstGPSApp.MyFirstGPSApp/files/ormdemo.db3 actually.
Do I need special permision to write in /DCIM folder?
Personal/Internal folder doesn't need permission, public/external folder need permission.
In /storage/sdcard folder, only Android folder is personal/internal folder, so you need permission:<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> or <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> or both.
You can't see directly from mobile without root permissions.
Try using Android Studio's File explorer feature.

Android,SQLite: Retrieving database file

After creating a database file and tables in android studio.
I went to the /data/data directory(at the android device monitor) and the only directories I see are named 'con',
and not my package name.
I know there are three options:
1. I can't get the database directory because I'm working with the emulator.
2. To specify a new directory to put this file in(I don't know how).
3. To re-install android studio(I doubt it will help)
What can I do tot fix it?and what is the problem?

Can't find my db file

My app creates sqlite database which file path starts with "/data/data/". From what I can see, data is stored correctly. But when I try to find the file itself (with ES Explorer), I just can't! Even the path "/data/data/" doesn't exist. Where can it be?
You can find your database in
/data/data/your.application.package/databases/your_db_name
This is the default path to your database
You don't have permission to look at that folder in your file explorer. In an emulator the same happens in the Eclipse file explorer. You can however access this path in the debug mode.
It really is in /data/data/your.application.package/databases/dbname.db
/data/data/[your_package_name]/databases/[your_db_name].db

how to view (see) the stored values in the database in android without programatically

Can somebody help me to see the values that are stored in a database non-programatically? Using file explorer and command prompt?
using command line
a) enter adb shell
b) cd to your app directory, database file will under databases folder
c) $sqlite3 yourdb_name
d) ## now you should enter command mode
e) select * from your_tablename;
using ddms
a) using DDMS's file explorer
b) find the database file
c) copy databases to ypur PC
d) use any sqlite tool to read it
Good luck!!
use sqlitebrowser
You can use the command line tool sqlite3(.exe) of the SQLite library.
Source: http://www.sqlite.org/sqlite.html
download sqlite browser and browse your data and you can see its tables and its data use this blog to learn more.
Is it possible to get the Database from the DDMS in eclipse?
I was searching in the data folder for the application and I didn't find it there.

Categories

Resources