2012-01-15 43 views
6

Tôi đang cố gắng truy cập cơ sở dữ liệu SQLite từ dòng lệnh cho một ứng dụng Android mà tôi đã phát triển. Tôi nhập adb shell để kết nối với thiết bị và sau đó sqlite3 để kết nối với cơ sở dữ liệu. sqlite3 mang lại cho tôi sau một lỗi: /system/bin/sh: sqlite3: không tìm thấyTruy cập cơ sở dữ liệu SQLite từ dòng lệnh

+0

bạn đã nhận được gì sau khi nhập adb vỏ? – Yury

+0

shell @ android:/$ – JustCurious

+0

Đây có phải là thiết bị hoặc trình giả lập không? – Yury

Trả lời

0

Hãy thử gõ "adb shell loại sqlite3" để xem liệu sqlite3 có sẵn trong điện thoại của bạn hay không.

Đối với điện thoại của tôi, nó hiển thị như sau

$ adb shell loại sqlite3 -> sqlite3 là một bí danh theo dõi trong/system/xbin/sqlite3

0
// Below code works on windows platform.. tried on windows 7 and windows 8 
// This is vb script code.. save with .vb extention. 
// any problems in saving.. please copy paste any vb file from ur system,take that second file ,open it with notepad and clear all contents, paste the below code as i did same. 
// double click to run file. output shown will ur all tables. and u can continue with  the own sql statements 

// note : works with only one emulator. many emulator are supported. 
// please dont try this code with mobile, you wont be able to access mobile database 

// start of script 


Set WshShell = WScript.CreateObject("WScript.Shell") 
// set ur path to platform tools in ur sdk 
strApp = "E:\Android\sdk\platform-tools" 

arrPath = Split(strApp, "\") 

For i = 0 to Ubound(arrPath) 
    strAppPath = strAppPath & arrPath(i) & "\" 
Next 



WshShell.CurrentDirectory = strAppPath 

WshShell.Run ("cmd.exe") 
WScript.Sleep 50 
WshShell.SendKeys "adb shell" 
WshShell.SendKeys "{ENTER}" 

// put ur package name and database name over here. please put ur db name with .db   extension 



WshShell.SendKeys "sqlite3 /data/data/package_name/databases/database_name" 
WshShell.SendKeys "{ENTER}" 
WshShell.SendKeys ".tables" 
WshShell.SendKeys "{ENTER}" 
Set objShell = Nothing 
// script ends 
+0

đưa ra tất cả các nhận xét trước khi tạo tệp vb – Sush

Các vấn đề liên quan