Problem with installing database.

You must Login before you can answer or comment on any questions.

Hello there,

I have a problem with installing a database;

In the app. js i have the following code:

var db = Ti.Database.install('radar.db', 'radar');
    db.close();In my resources folder there is a file/database called radar.db.
 
in another .js file i try to open the database with the following code: 
db = Ti.Database.open ( 'radar' );
When i start the app i get a runtime error message wich says:
Location:
=======
[102,19]ti:/invoker.js
 
Message:
=======
Uncaught Error: install: Invalid number of arguments. Excpected 3 but got 2
 
Source:
======
    return delegate.apply(invoker.__thisOBj__,
 
 args);
Its a mobile project using titanium sdk 2.1.2 GA for android 4.0.3

Does somebody have the answer for this problem?

Thanks in advance!

— asked 8 months ago by Robin Lammers
2 Comments
  • radar.db is an actual sqlite db and not a sql script, correct?

    — commented 8 months ago by Adam Paxton

  • need more code to better understand issue

    — commented 8 months ago by Aaron Saunders

1 Answer

After a long tries i found an answer You need to give absolute path of database file..

like

var path = Titanium.Filesystem.resourcesDirectory; var store_dbname = 'stores.db';

db = Titanium.Database.install(path+'data/stores.db', store_dbname);

db.close();

here data is folder under Resources/ and stores.db is your database.

Thats it Hope this may help....

Your Answer

Think you can help? Login to answer this question!