Android 在命令提示符下打开 Sqlite Db
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3415702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Opening Sqlite Db on command prompt
提问by MGSenthil
Friends, I am working on Sqlite DB and I want to open, view or create databases through the ADB shell command. I've written the following commands in command prompt
朋友们,我正在研究Sqlite DB,我想通过ADB shell 命令打开、查看或创建数据库。我在命令提示符中编写了以下命令
cd C:\android-sdk_r04-windows\android-sdk-windows\tools>
adb shell
cd C:\android-sdk_r04-windows\android-sdk-windows\tools>
adb shell
I get a $
after step 2.
Any idea how I can get sqlite>
prompt instead and perform the following task?
我$
在第 2 步之后得到了一个。知道如何获得sqlite>
提示并执行以下任务吗?
Suppose I want to view the databases. I've written cd/data/data/(mypackage)/databases
sqlite3 (database)... after the $
but it says 'Database not found.'
How can I view the databases executed through my code?
假设我想查看数据库。我写了cd/data/data/(mypackage)/databases
sqlite3 (database)... 之后,$
但它说“未找到数据库”。如何查看通过我的代码执行的数据库?
Thanks in advance.
提前致谢。
回答by Tushar Tarkas
You can use sqlite3 command to connect to database from adb shell. Find example of sqlite3 form Android Developers. This will open an sql prompt where you can execute standard commands supported. Another link which explains creating a database, creating table and viewing its contents all from command prompt (adb shell) is here.
您可以使用 sqlite3 命令从 adb shell 连接到数据库。查找sqlite3 表单 Android Developers 的示例。这将打开一个 sql 提示符,您可以在其中执行支持的标准命令。另一个解释创建数据库,创建表并从命令提示符(adb shell)查看其内容的链接是here。