Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

invalid database install path error when running application on iPhone

Hi guys,

I need some help please.

Is there any reason to why I'm getting the following error when I install my app on my iPhone, everything seems to be working fine on the simulator but on the actual device I receive the following error.

Basically it's related to an sqllite database I've created on the resources folder under a new folder called databases, just wondering if I need to replace this file any where else or what will be the solution. However the error message I'm receiving is the following:

invalid databse install path.
/var/mobile/Applications/FE1 -
896DDD6B431C/test.app/databases/test in -
(TiDatabaseProxy.m:87) at
app.js (line 1)

— asked April 4th 2010 by Samuel Lopez
  • database
  • error
  • path
  • sqllite

2 Answers

  • I figured out the solution to my issue, thanks for your help guys :) just joking…

    Basically the following function file name is case sensitive so make sure your database is called 'testDatabase.sql' and not 'testdatabase.sql' otherwise you will get the same error I've received.

    var db = Titanium.Database.install('databases/testDatabase','test);

    Good luck and happy coding :)

    — answered April 5th 2010 by Samuel Lopez
    • I'm getting the exact same error but got no problem with the filename.. Any idea ?

      — commented September 26th 2011 by Emmanuel Balpe
    • Same here. Any ideas?

      — commented June 17th 2012 by Kate Ho
  • Major headache, but I found the solution. Use database.open() instead of install() except when you are truly opening a particular database under a particular name for the very first time.

    In my app, I used Ti.Database.install() both for installing and opening the database. Even for opening the database when I could be absolutely sure that nothing changed since the last time the user opened the app.

    This is consistent with the docs, which state that "If the destination file already exists, [ install ] behaves as open."

    However, install does not behave as open. Not in my case, on iOS device, with Ti SDK 3.1.0. If you've already installed a particular database file and given it a particular name, then you cannot do install() with that file and that name. This will cause the "invalid database install path" error.

    Although of course, the very first time you use install on a file, this will work just fine, since at that point it actually installs.

    Strangely, using install() for opening an existing database with an existing memory name does work in some other situations too. It may have to do with the file location. In my app, I have a mechanism for downloading updates for the database file, and giving those a versioned name so there will never be conflicts.

    The downloaded db files are stored in a path starting with: Ti.Filesystem.applicationDataDirectory
    Using install() any number of times on this filename is no problem, whether the db name variable is new or old.

    The pre-installed database that comes with the app is located in: Ti.Filesystem.resourcesDirectory
    Using install() a second time with this filename and an existing db name causes the install path error.

    Hope this helps!

    — answered April 25th 2013 by remko posthuma
    1 Comment
    • Thanks for this. I, for one, will bear it in mind. The app I'm developing at the moment is for Android and 'install' works on both emulator and device, no matter how often i run the app. But it did strike me as odd to use 'install' - and I've read the doc several times to make sure I understood it correctly. Now, when I get to developing the Iphone app, I'll remember your words and wont tear my hair out if it doesn't work!

      — commented May 25th 2013 by jacky girling
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.