android sqlite数据库简单操作(adb shell)

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。 http://blog.csdn.net/love254443233/article/details/7534119

1、用adb.exe查找正在运行的设备(至少要打开一个模拟器)

E:\android-sdk-windows\platform-tools\adb devices

List of devices attached
emulator-5554 device

2、如果模拟器没有运行,使用以下命令启动

E:\android-sdk-windows\tools\emulator.exe @avdname

3、查看虚拟设备,使用以下命令启动

E:\android-sdk-windows\tools\android list avd

Available Android Virtual Devices:
Name: 2_3_3
Path: C:\Documents and Settings\Administrator\.android\avd\2_3_3.avd
Target: Android 2.3.3 (API level 10)
Skin: 320x533
Sdcard: 50M

4、在连接的设备上打开一个shell

E:\android-sdk-windows\platform-tools\adb shell

5、查看自己的数据库

# ls -R /data/data/*/databases

/data/data/cn.edu.xtu.tilepuzzle/databases:
DBTilePuzzle.db

/data/data/com.android.browser/databases:
webview.db
webviewCache.db
browser.db

/data/data/com.android.deskclock/databases:
alarms.db

/data/data/com.android.email/databases:
EmailProvider.db
EmailProviderBody.db

/data/data/com.android.inputmethod.latin/databases:
userbigram_dict.db
auto_dict.db

/data/data/com.android.launcher/databases:
launcher.db

/data/data/com.android.providers.contacts/databases:
contacts2.db

/data/data/com.android.providers.downloads/databases:
downloads.db

/data/data/com.android.providers.media/databases:
internal.db
external-8f72d02.db

/data/data/com.android.providers.settings/databases:
settings.db


/data/data/com.android.providers.telephony/databases:
telephony.db
mmssms.db

/data/data/com.android.providers.userdictionary/databases:

user_dict.db


6、找到自己的数据库

/data/data/cn.edu.xtu.tilepuzzle/databases:
DBTilePuzzle.db


7、打开数据库

# sqlite3 /data/data/cn.edu.xtu.tilepuzzle/databases/DBTilePuzzle.db


8、查询己存在的表的数据及简单操作(TableGameData、TablePeopleInfoData两个表是我事先创建好的数据库表)

sqlite>select * from TableGameData;

/rs/raw/img/first.jpg|Y|Y|Y|Y|4|5

sqlite>select * from TablePeopleInfoData;

LIUYAOHUA|50
DAIQING|100
YAOHUA|14

sqlite> insert into TablePeopleInfoData values("liu1",1000);

LIUYAOHUA|50
DAIQING|100
YAOHUA|14
liu1|1000

sqlite> update TablePeopleInfoData set TIME=140 where NAME="YAOHUA"

sqlite> select * from TablePeopleInfoData;
LIUYAOHUA|50
DAIQING|100
YAOHUA|140
liu1|1000

sqlite> delete from TablePeopleInfoData where NAME="liu1";
sqlite> select * from TablePeopleInfoData;

select * from TablePeopleInfoData;
LIUYAOHUA|50
DAIQING|100

(这样就不必每次用“System.out.println”去查看数据库里的表信息更改的情况了)

你可能感兴趣的:(android sqlite数据库简单操作(adb shell))