I wanted to access my existing .db file from sdcard using phoneGap but method available in phoneGap accepts only database name not path as given below.
var db = window.openDatabase(“Database”, “1.0”, “Cordova Demo”, 600000);
so I thought to make changes in cordova-1.7.0.jar which has native code to communicate with device. I found Storage.java which has openDatabase(String db, String version, String display_name,long size) method wherein I just need to assign a variable i.e
path = “/mnt/sdcard/database” and recompile the .jar file. so I downloaded cordova source from below given path i.e. https://github.com/apache/incubator-cordova-android and made changes in this and created new .jar file to use in my project. but its giving error when application loads.
It would be better to write your code as a plugin as PhoneGap uses the WebKit database. There is already a plugin for accessing external SQLite database, but it is for iOS. Nevertheless, it would be a good starting point for you to write your own plugin for Android. The existing plugin can be found in https://github.com/davibe/Phonegap-SQLitePlugin