Android - 如何查看在我的应用程序中创建的SQL数据库?我在Eclipse的Android模拟器上运行它

时间:2021-06-30 18:53:59

I have an Android application that uses the Android database to create tables and store data. I'm currently running this app in the emulator in Eclipse. I have 2 questions:

我有一个Android应用程序,它使用Android数据库来创建表和存储数据。我目前正在Eclipse中的模拟器中运行此应用程序。我有两个问题:

  1. Where can I find the actual database file (it must be on my computer somewhere right?) that is created when I run my app in the emulator?
  2. 我在哪里可以找到在模拟器中运行我的应用程序时创建的实际数据库文件(它必须在我的计算机上某处?)?
  3. Is there an easy way to view what is in my database/tables?
  4. 有没有一种简单的方法来查看我的数据库/表中的内容?

If I could find where the actual database file is (if there is such a thing) on my computer, then perhaps question 2 would be answered as easily as opening that file. But I really have no clue. Any help is appreciated.

如果我能在我的计算机上找到实际数据库文件的位置(如果有这样的东西),那么问题2的回答就像打开该文件一样容易。但我真的不知道。任何帮助表示赞赏。

3 个解决方案

#1


11  

Hi

你好

1. In the Eclipse look at the File Explorer tab (near the Console tab). Or look at menu "Window -> Show View -> Other... -> File Explorer". Emulator should be run. In the File Explorer window go to the folder "data/data/[your_package_name]/databases/". There you can find your database. You can export it to the your computer. At the right top corner of the window there is a button "pull a file from device". Select database, click that button and save a database on the computer.

1.在Eclipse中查看“文件资源管理器”选项卡(“控制台”选项卡附近)。或者查看菜单“窗口 - >显示视图 - >其他... - >文件资源管理器”。应该运行模拟器。在文件资源管理器窗口中,转到文件夹“data / data / [your_package_name] / databases /”。在那里你可以找到你的数据库。您可以将其导出到您的计算机。在窗口的右上角有一个按钮“从设备中提取文件”。选择数据库,单击该按钮并在计算机上保存数据库。

2. Program "sqlite browser" can shows a data in the database. You can download it here. It is easy to use.

2.程序“sqlite browser”可以显示数据库中的数据。你可以在这里下载。它很容易使用。

#2


2  

The database is stored in the following location on the emulator (assuming your app has the package com.example.app and a database named db-name.db):

数据库存储在模拟器上的以下位置(假设您的应用程序包含com.example.app包和名为db-name.db的数据库):

/data/data/com.example.app/db-name.db

You can access it from the command line as follows:

您可以从命令行访问它,如下所示:

cmd> adb -e shell
cmd> sqlite3 /data/data/com.example.app/databases/db-name.db
sqlite> select * from table_name;
sqlite> 1|Example Item 1|1|
sqlite> 2|Example Item 2|2|
sqlite>

#3


0  

If you want to browse your databases inside eclipse follow these instructions taken from here:

如果你想在eclipse中浏览你的数据库,请按照这里的说明操作:

Android - How can I view a sql database created in my app? I'm running it on the Android emulator in Eclipse

Android - 如何查看在我的应用程序中创建的SQL数据库?我在Eclipse的Android模拟器上运行它

1.Download the Questoid Plugin

1.下载Questoid插件

2.Place the file in your Eclipse plugins folder (e.g. /usr/lib/eclipse/plugins)

2.将文件放在Eclipse插件文件夹中(例如/ usr / lib / eclipse / plugins)

3.Restart Eclipse

3.Restart Eclipse

4.Start up an Android Emulator w/ Debugging in Eclipse

4.启动一个Android模拟器,在Eclipse中进行调试

5.Switch to the DDMS Perspective in Eclipse

5.转到Eclipse中的DDMS Perspective

6.Go to the 'File Explorer' tab to locate your device's database file

6.转到“文件资源管理器”选项卡以找到设备的数据库文件

7.Navigate to: e.g. 'data -> data -> com.myproject -> databases -> myproject

7.导航至:例如'data - > data - > com.myproject - > databases - > myproject

8.Open the database file in Questoid (see screen shot)

8.在Questoid中打开数据库文件(参见屏幕截图)

9.Switch to the 'Questoid SQLite Browser' tab that appears

9.切换到出现的'Questoid SQLite Browser'选项卡

10.Switch to the 'Browse Data' sub tab

10.切换到“浏览数据”子选项卡

11.Select your table from the drop down menu

11.从下拉菜单中选择您的表格

12.Browse your data here and onward into the digital sunset

12.在此处向前浏览您的数据到数字日落

Android  - 如何查看在我的应用程序中创建的SQL数据库?我在Eclipse的Android模拟器上运行它

#1


11  

Hi

你好

1. In the Eclipse look at the File Explorer tab (near the Console tab). Or look at menu "Window -> Show View -> Other... -> File Explorer". Emulator should be run. In the File Explorer window go to the folder "data/data/[your_package_name]/databases/". There you can find your database. You can export it to the your computer. At the right top corner of the window there is a button "pull a file from device". Select database, click that button and save a database on the computer.

1.在Eclipse中查看“文件资源管理器”选项卡(“控制台”选项卡附近)。或者查看菜单“窗口 - >显示视图 - >其他... - >文件资源管理器”。应该运行模拟器。在文件资源管理器窗口中,转到文件夹“data / data / [your_package_name] / databases /”。在那里你可以找到你的数据库。您可以将其导出到您的计算机。在窗口的右上角有一个按钮“从设备中提取文件”。选择数据库,单击该按钮并在计算机上保存数据库。

2. Program "sqlite browser" can shows a data in the database. You can download it here. It is easy to use.

2.程序“sqlite browser”可以显示数据库中的数据。你可以在这里下载。它很容易使用。

#2


2  

The database is stored in the following location on the emulator (assuming your app has the package com.example.app and a database named db-name.db):

数据库存储在模拟器上的以下位置(假设您的应用程序包含com.example.app包和名为db-name.db的数据库):

/data/data/com.example.app/db-name.db

You can access it from the command line as follows:

您可以从命令行访问它,如下所示:

cmd> adb -e shell
cmd> sqlite3 /data/data/com.example.app/databases/db-name.db
sqlite> select * from table_name;
sqlite> 1|Example Item 1|1|
sqlite> 2|Example Item 2|2|
sqlite>

#3


0  

If you want to browse your databases inside eclipse follow these instructions taken from here:

如果你想在eclipse中浏览你的数据库,请按照这里的说明操作:

Android - How can I view a sql database created in my app? I'm running it on the Android emulator in Eclipse

Android - 如何查看在我的应用程序中创建的SQL数据库?我在Eclipse的Android模拟器上运行它

1.Download the Questoid Plugin

1.下载Questoid插件

2.Place the file in your Eclipse plugins folder (e.g. /usr/lib/eclipse/plugins)

2.将文件放在Eclipse插件文件夹中(例如/ usr / lib / eclipse / plugins)

3.Restart Eclipse

3.Restart Eclipse

4.Start up an Android Emulator w/ Debugging in Eclipse

4.启动一个Android模拟器,在Eclipse中进行调试

5.Switch to the DDMS Perspective in Eclipse

5.转到Eclipse中的DDMS Perspective

6.Go to the 'File Explorer' tab to locate your device's database file

6.转到“文件资源管理器”选项卡以找到设备的数据库文件

7.Navigate to: e.g. 'data -> data -> com.myproject -> databases -> myproject

7.导航至:例如'data - > data - > com.myproject - > databases - > myproject

8.Open the database file in Questoid (see screen shot)

8.在Questoid中打开数据库文件(参见屏幕截图)

9.Switch to the 'Questoid SQLite Browser' tab that appears

9.切换到出现的'Questoid SQLite Browser'选项卡

10.Switch to the 'Browse Data' sub tab

10.切换到“浏览数据”子选项卡

11.Select your table from the drop down menu

11.从下拉菜单中选择您的表格

12.Browse your data here and onward into the digital sunset

12.在此处向前浏览您的数据到数字日落

Android  - 如何查看在我的应用程序中创建的SQL数据库?我在Eclipse的Android模拟器上运行它