Is there any tool that will allow me to browse databases on my Android device? Something like Sql Management Studio - you know GUI tool that displays databases, tables, row in tables, etc.
I'm using Eclipse for development (if it is important for plug-in suggestions).
Thanks!
To show all databases in the current connection, you use the . databases command. The . databases command displays at least one database with the name: main .
The Android SDK provides dedicated APIs that allow developers to use SQLite databases in their applications. The SQLite files are generally stored on the internal storage under /data/data/<packageName>/databases.
a) On Windows, From the View menu item select 'preferences' and select the Data Browser tab. b) On Mac, From the “DB Browser for SQLite” menu item select 'preferences' and select the Data Browser tab.
First of all, you will not be able to 'browse' the databases unless you logged in as root (there are several tutorials out there that explains how to get root on Android). Secondly, you can use adb shell
(adb is included into the SDK), and when you are there you can use the sqlite3
command to browse the databases.
Of course, sqlite3
does not provide a GUI... but, you can copy the database you want to browse to your computer and use any GUI for sqlite there.
Yes we can do this but in different way.Using this logic you will get database in SDcard
.
String sourceLocation = "/data/data/com.sample/databases/yourdb.sqlite" ;// Your database path
String destLocation = "yourdb.sqlite";
try {
File sd = Environment.getExternalStorageDirectory();
if(sd.canWrite()){
File source=new File(sourceLocation);
File dest=new File(sd+"/"+destLocation);
if(!dest.exists()){
dest.createNewFile();
}
if(source.exists()){
InputStream src=new FileInputStream(source);
OutputStream dst=new FileOutputStream(dest);
// Copy the bits from instream to outstream
byte[] buf = new byte[1024];
int len;
while ((len = src.read(buf)) > 0) {
dst.write(buf, 0, len);
}
src.close();
dst.close();
}
}
return true;
} catch (Exception ex) {
ex.printStackTrace();
return false;
}
You have to give permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With