Titanium Community Questions & Answer Archive

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

Database start... a good and working example/doc ?

Hi all,

I'm trying to work with the Titanium.Database API but still can get anything good from it…

I created a new folder under Resources and I wanna save my db file there… this is the 5lines of code that I run (according to the documentation)

http://www.pastie.org/private/yl8gmetsjgdfdpmchqdbg

but I keep getting the same error:

A SQLite database error occurred on database
'......./Library/Application Support/database/dbtest.db.sql': 
Error Domain=com.plausiblelabs.pldatabase Code=1 UserInfo=0x53280a0 
"The SQLite database file could not be found." 
(SQLite #14: unable to open database file) (query: '<none>')
[WARN] couldn't open database. in -[TiDatabaseProxy open:] (TiDatabaseProxy.m:79)
[ERROR] Script Error = couldn't open database. 
in -[TiDatabaseProxy open:] (TiDatabaseProxy.m:79) at app.js (line 83).
— asked June 10th 2010 by Joe Maffia
  • database
  • mobile
  • sql
  • sqlite3
0 Comments

3 Answers

  • Accepted Answer

    Is there any reason why you need to specify where the DB is located and not just let the device handle that (which it does without any issues)

    check out the persistence demo application (http://github.com/kwhinnery/Persistence), it's a great place to "get started"

    — answered June 10th 2010 by Stephen Gilboy
    permalink
    1 Comment
    • was mainly for a folder structure preference… but even without that, can't get the Titanium.Database.install() working.

      I'll download that application and give it a try in that way.

      Thanks.

      — commented June 10th 2010 by Joe Maffia
  • Is that file you're trying to install a SQL script or an actual database file? The latter is what you need (an actual SQLite database). Easiest way to work with a SQLite database is through a tool like this simple admin app (Firefox plug-in).

    — answered June 10th 2010 by Kevin Whinnery
    permalink
    1 Comment
    • I was simply trying to create a new DB to start storing some data inside from the app

      — commented June 10th 2010 by Joe Maffia
  • The Persistence app…does the job ;)

    Thanks for the tip.

    — answered June 10th 2010 by Joe Maffia
    permalink
    0 Comments
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.