PhoneGap的:我无法找到Android模拟器我的SQLite数据库 [英] Phonegap: i can't find my sqlite database on android emulator
问题描述
我尝试创建我的第一个PhoneGap的应用程序。我的移动开发previous经验是一个Android应用程序。
我终于创建一个数据库,并与上述code里面存储一些数据:
I try to create my first Phonegap app. My previous experience with mobile developing was an android application. I create finally a database and store some data inside with above code:
document.addEventListener("deviceready", onDeviceReady, false);
// Populate the database
//
function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS DEMO');
tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');
}
// device APIs are available
//
function onDeviceReady() {
var db = window.openDatabase("LIST", "1.0", "LIST Demo", 200000);
db.transaction(populateDB, errorCB, successCB);
}
现在我试图找到在这条道路上我模拟器数据库(正如我在很多帖子读):
Now i try to find my Database on emulator (as i read in many posts) in this path:
/数据/数据/ {包名} /数据库
/data/data/{package_name}/database
或
/数据/数据/ {包名} / app_database
/data/data/{package_name}/app_database
但什么也没有。我只找到上面的数据库
but nothing there. I only found the above databases
webview.db
webview.db-shm
webview.db-wal
webviewCookiesChromium.db
webviewCookiesChromiumPrivate.db
所有这些数据库中,我不能拉他们从仿真器,看看里面有。
在哪里可以找到我的数据库?
我希望能找到有什么样LIST.DB但没有。对吧?
All this database i can't pull them from emulator to see what have inside. Where i can find my database? I expect to find something in there like LIST.DB but nothing. Right?
推荐答案
在onDeviceReady()函数可以使用:
In the "onDeviceReady()" function you can use:
如果(!dbCreate的){
DB = window.sqlitePlugin.openDatabase(001010101010,1.0,MY_DATABASE,-1);
}
if(!dbcreate){ db = window.sqlitePlugin.openDatabase("001010101010", "1.0", "My_Database", -1); }
And for load file:
文件DBFILE = getDatabasePath(001010101010.db。);
数据库文件需要在接下来的路线:
File dbFile = getDatabasePath(".001010101010.db"); The DB file needs to be in the next route:
yourProyect /资产/ 001010101010.db。
yourProyect/assets/001010101010.db.
您还可以查询更多关于sqllite: HTTP ://gauravstomar.blogspot.in/2011/08/$p$ppopulate-sqlite-in-phonegap.html
you can also check more about sqllite : http://gauravstomar.blogspot.in/2011/08/prepopulate-sqlite-in-phonegap.html
这篇关于PhoneGap的:我无法找到Android模拟器我的SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!