2

I'm trying to create a script to simplify data checking with sqlite. For me it's quite troublesome to write :

adb shell
sqlite /data/data/my.package.name/databases/mydatabse.db

every time I want to check something in the db (and in the beginning phases of db development this is quite often), especially because TAB completion doesn't seem to work (at least for me). So I tried to write a script to automatically open the database for me, but the android documentation clearly states that:

shell [<shellCommand>] - Issues a shell command in the target emulator/device 
                         instance and then exits the remote shell.

So I was wondering whether there would be some way around that, so that my shell would remain running and I could use the sqlite3 command-line program. With a bit of help from here I was able to create scripts that run specific database queries, like so (but I'd like to keep the sqlite command-line program running):

#!/bin/bash
adb shell sqlite3 /data/data/my.package.name/databases/mydatabse.db "select * from someTable"

Thanks in advance!

1
  • Share a little bit about what shell/s are available on android. Are you using bash or ?? or something specific to android? Although there are 1.2K followers for shell, probably 1/2 or them are Windows users. If there is a specific name for the android shell, better to include it. Hover on each of your tags to see the numbers of followers. 12 followers seems to be a waste of a tag. Good luck. Commented Nov 28, 2011 at 0:49

2 Answers 2

1

You could try adding quotes around your adb commands, like mentioned here.

adb shell "sqlite /data/data/my.package.name/databases/mydatabse.db"

Make sure you have permission to access your database (read/write).

There is a github code published for dumping dbs, from here. Direct link: https://github.com/Pixplicity/humpty-dumpty-android/blob/master/humpty.sh

Sign up to request clarification or add additional context in comments.

1 Comment

You should quote the relevant parts for the link, and explain it a little bit. Check this: stackoverflow.com/help/how-to-answer
0

How about just using the command adb shell

Then run: sqlite /data/data/my.package.name/databases/mydatabse.db

This will keep the window open and then you just need to push up to get the last command.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.