1

I am developing a android mobile application using phonegap.In application I created sqlite database and write the code of inserting data into database.all is working fine,inserting data on database,retrieving data from database.but when I need to see the database tables which I created.it wont show.I used below steps to see sqlite database.

DDMS=>File Explorer=>data=>data=>com.example.contactdb=>app_database

But app_database doesn't contain any file.

Please see my screen shot: enter image description here

I checked permission in AndroidManifest.xml. I added these lines for permissions. But did not understand which one of these is for accessing database.

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission    android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

So how I can I view the sqlite database that I created through Application and runs on the emulator.

Note:I am using emulator for testing.

System Details:

  • OS:windows xp sp3
  • Eclipse Version: Kepler Service Release 2
  • Database:sqlite
  • Phonegap V:2.7

3 Answers 3

1

Well if you can't find it on device monitor its probably doesn't exist!! I don't know much about phonegap but make sure your code for creating database is correct especially check the query you're using to build database, even missing a semicolon at the end of query can cause this problem. After applying any change remember to change database version. (I'm not sure you have this in phonegap!)

Sign up to request clarification or add additional context in comments.

2 Comments

I am using Eclipse Kepler for development, Android Emulator there can be used for testing PhoneGap apps developed. We are able to read the data so created in the App using code. The data remains there in SQL lite database when I restart PC and goto my PhoneGap application thr' Esclipse Kepler/Android Emulator.
Well in that case, i don't see any logical reason for your problem! good luck
1

WRITE_EXTERNAL_STORAGE is used to access external SDcard

Also See this link below

Android permission of creating database

1 Comment

I removed “WRITE_EXTERNAL_STORAGE” from AndroidManifest.xml file but still not able to view database file in SQL Lite. I am sure it is storing in database, because when I open my application again, I am able to view previously saved data. But my issue is I am unable to see same database using SQL Lite.
1

To check your sqlite database you can use the built-in sqlite tool from the adb remote shell:

adb -s TheIdOfTheEmulator shell
# sqlite3 /data/data/your.package.name/databases/yourDatabaseFile.db
     SQLite version 3.3.12
     Enter ".help" for instructions
     .... enter commands, then quit...
     From here you can query your database using sqlite language
sqlite> .exit 

2 Comments

Thanks,I am new to eclipse kepler IDE,I am not able to find out adb-shell command prompt.
adb is a command line tool, provided with the Android SDK. There is a lot of documentation about it on developer.android.com/tools/help/adb.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.