Menu

#39 Strange SQLite error 14 (unable to open database file)

Invalid
nobody
None
Medium
Other
2012-02-24
2012-02-22
Anonymous
No

Originally created by: robert.c...@gmail.com

I used the procedure described by https://code.google.com/p/sqlite4java/issues/detail?id=29 and I am able to run this sqlite wrapper on Android. Which is good!

However, I am having a very strange (to me at least) problem.

My test involves identical databases with BLOB content.... there are 2 attached DBs with the same structure ... they have a table named "media" with just 2 fields, name (text) and content (BLOB). The BLOB content is 1MB worth of binary data.

The 2 tables have one row each only.

The query is very simple:

SELECT * FROM main.media WHERE main.media.name='1024k_02_0.in' UNION SELECT * FROM attached_1.media WHERE attached_1.media.name='1024k_22_1.in'

where "attached_1" is the alias I used when attaching the second database to the main one.

I'm doing SQLiteConnection.prepare() then I'm calling step() from the resulted SQLiteStatement that's all.

Strangely, step() returns a vague error [14] "unable to open database file".

If I repeat the same thing using the sqlite3 tool via adb shell, it works fine (no errors).

The exact same code runs fine on Linux. The exact same code runs fine if the BLOB content stored by the database tables is less than 1MB (works with no errors if it's 200KB or so).

I am using the 2 attached databases in other queries and they all work okay. The problem is when the query uses the tables that have the large BLOB content.

Related

Tickets: #29

Discussion

  • Anonymous

    Anonymous - 2012-02-22

    Originally posted by: robert.c...@gmail.com

    Here's the error

    com.almworks.sqlite4java.SQLiteException: [14] DB[3] step() [SELECT * FROM main.media WHERE main.media.name='1024k_0_0.in' UNION SELECT * FROM attached_1.media WHERE attached_1.media.name='1024k_0_1.in']DB[3][C] [unable to open database file]
    at com.almworks.sqlite4java.SQLiteConnection.throwResult(SQLiteConnection.java:1248)
    at com.almworks.sqlite4java.SQLiteConnection$BaseController.throwResult(SQLiteConnection.java:1501)
    at com.almworks.sqlite4java.SQLiteStatement.stepResult(SQLiteStatement.java:1231)
    at com.almworks.sqlite4java.SQLiteStatement.step(SQLiteStatement.java:302)
    .......................................

     
  • Anonymous

    Anonymous - 2012-02-23

    Originally posted by: robert.c...@gmail.com

    Ok I suspect this needs rejected/closed. The problem seems to be outside of sqlite4java's territory. I apologize for that!

     
  • Anonymous

    Anonymous - 2012-02-24

    Originally posted by: ser...@gmail.com

    Robert, no worries. Thanks for the update.

    Since SQLite opens database file every time a transaction starts, it may fail if the file is locked somehow. You can reduce the risk by combining several selects into one transaction with BEGIN statement.

    Igor

    Labels: -Type-Defect Type-Other
    Status: Invalid

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.