SqliteException: Unable to open the database file

Hi,

I’m developing an Android application where I store a list of furnitures in a SQLite database. I have two tables: one storing the basic data of the furniture (table named Furnitures) and another one where I store the data that can be translated (table named FurnitureData).

I get data from the database using Mono.Data.Sqlite for Unity. I try to retrieve the furnitures in the language set by the user, and if the furniture is not translated in that language I want to retrieve it in English. This is the query I’m doing to retrieve the data if the user has set language as French:

SELECT _ID, name, image_small, catalog, object_name FROM 
    (SELECT f._ID, name, image_small, catalog, object_name 
    FROM Furnitures as f, FurnitureData as d 
    WHERE f._ID = d._ID AND lang IN ('fr','en') AND catalog IS NOT NULL  
    ORDER BY lang ASC ) 
as t 
GROUP BY _ID

I use a subquery to be able to implement the “default language” feature. The value in the order by (ASC or DESC) depends on the value of the language.

This query is working if the language set is English (same as default one), but if I use a different language I get an exception like this:

SqliteException: Unable to open the database file
unable to open database file
at Mono.Data.Sqlite.SQLite3.Reset (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] in <filename unknown>:0 
at Mono.Data.Sqlite.SQLite3.Step (Mono.Data.Sqlite.SqliteStatement stmt) [0x00000] in <filename unknown>:0 
at Mono.Data.Sqlite.SqliteDataReader.NextResult () [0x00000] in <filename unknown>:0 
at Mono.Data.Sqlite.SqliteDataReader..ctor (Mono.Data.Sqlite.SqliteCommand cmd, CommandBehavior behave) [0x00000] in <filename unknown>:0 
at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteDataReader:.ctor (Mono.Data.Sqlite.SqliteCommand,System.Data.CommandBehavior)
at Mono.Data.Sqlite.SqliteCommand.ExecuteReader (CommandBehavior behavior) [0x00000] in <filename unknown>:0 
at Mono.Data.Sqlite.SqliteCommand.ExecuteReader () [0x00000] in <filename unknown>:0 
at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteCommand:ExecuteReader ()
at Mono.Data.Sqlite.SqliteCommand.ExecuteReader (CommandBehavior behavior) [0x00000] in <filename unknown>:0 
at Mono.Data.Sqlite.SqliteCommand.ExecuteReader () [0x00000] in <filename unknown>:0 
at (wrapper remoting-invoke-with-check) Mono.Data.Sqlite.SqliteCommand:ExecuteReader ()
at DefaultGUIBehaviour+<LoadDataFromDB>c__Iterator6.MoveNe

I can’t understand why is this working if the language is the same as the default one, but it doesn’t if the language is different. I used adb shell to perform the query directly in the database and it works, but in Unity it doesn’t.

The exception is thrown in the ExecuteReader line:

dbcmd = dbcon.CreateCommand();
dbcmd.CommandText = sql;
reader = dbcmd.ExecuteReader(); 

Anybody knows what might be going on?

Thank you!