0

I have a pre-populated sqlite database and I need to attach this within my Blackberry app. I am using phonegap and therefore using the following javascript code to open my database and then run a select statement:

db = window.openDatabase("TaxCalculatorDB","1.0","Tax Calculator DB",1000000);
db.transaction(Manufacturer, errorCB, successCB);

However, when trying to run my select statement I get an error (ERROR: 1 no such table:user).

I have added my database files (which I have succesfully used in a iOS build) directly into the assets folder, exactly the same way I had done before. Do i need to move this database folder elsewhere?

Please advice, Thanks.

SingleWave Games
  • 2,618
  • 9
  • 36
  • 52

1 Answers1

0

You have to have Javascript create the database when using webworks. There is currently no way to import an existing sqlite db into a webworks app. (You tagged this as phonegap, but I think phonegap uses webworks to create the app)

The common workaround to this is to include a JSON or XML file with all the data to be loaded. When you create the database, read the included file and add that data to it.

Core.B
  • 662
  • 3
  • 11
  • I was hoping this was not the case as I have about 8 tables 3 of which contain 4000 rows, which I assume is going to take quite a while to load. Thanks for the clarification. – SingleWave Games Mar 20 '12 at 09:41
  • Ouch. All I can suggest is run the JSON through a JS minimizer/compressor. – Core.B Mar 20 '12 at 18:32