10-12-2012 03:15 PM
I need to pick an underlying method of saving data collected in the field (offline and remote locations). I want to use the HTML5 Database with SQLite but I can I pick the location? So far, I haven't been able to accomplish that. Here is some sample code I was using:
var dbName = "";
var Dir = blackberry.io.dir;
var path = Dir.appDirs.shared.documents.path;
dbName = path + "/" + "databasetest.db";
var db = openDatabase(dbName, '1.0', 'Test', 50 * 1024);
I used an "alert()" to see the file was "supposedly" created, but when I opened the folder in Explorer I cannot find it. Not really sure why and hense my question.
My application is for data entry, without getting into specifics, user may end up collecting a lot or little data. But I want some way of downloading the SQLite database?
Is this the intention of the SQLite database, or will I have to use another solution?
10-12-2012 08:09 PM
The database you created on PlayBook should be in the folder: /accounts/1000/appdata/<appname>/data/database/loc
However, you shouldn't have to worry about the phsyical database implementation and I think you are on the right track. You just need to setup a local database on the device as you have done. Then, make an AJAX GET request to the server and use a for loop to insert the records from the server into your database on the PlayBook. To send the local contents of the database back to your server you can send an AJAX POST request. Depending on the amount of syncronization you need to do, you could check out this stackoverflow answer to guide you:
If you run into problems and aren't sure about the state of your database, open up Chrome's debugging tools (Control shift i), choose the tab "Resources" and click on "Web SQL" in order to view your database tables.
Hope this helps,
10-15-2012 02:43 PM
I've heard of the BlackBerry Desktop Software but not "Blackberry-Connect", is that something new? Do you have a download link, maybe I'm missing something.
Not sure if the AJAX GET/POST approach is best, and I do not have wifi where I am. Corporate policy. I have a mini-usb cable, it all must be doen through that. I guess that means AJAX is a no-go. I know what you are getting at, I'm just in a tighter sandbox than most developers.
I'll take a look at the sync libraries and see what fits my needs. I do like the idea of copying the database out to local storage and seeing how that works.
10-15-2012 03:33 PM
Blackberry-Connect is separate from Blackberry Desktop software. It is just a way of connecting to the PlayBook and obtaining SSH access. It is included in the Blackberry Tablet SDK. (http://openbbnews.wordpress.com/2011/12/21/devuser
HTML5 local storage or WebSQL should work fine for your use case!