- Home /
SQLite connection exception in android please help
Some one help me. I don't know why this exception has been happen. in editor no problem and everything work fine. I give the write permission to my game and .db file copy correctly. please help.
Exception:
storage/emulated/0/Android/data/com.parbaz.nfs/files/DB_01.db jar:file:///data/app/com.parbaz.nfs-1/base.apk!/assets/DB_01.db data/app/com.parbaz.nfs-1/base.apk storage/emulated/0/Android/data/com.parbaz.nfs/files jar:file:///data/app/com.parbaz.nfs-1/base.apk!/assets Database Exist URI=file:/storage/emulated/0/Android/data/com.parbaz.nfs/files/DB_01.db System.DllNotFoundException: sqlite3 at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods:sqlite3_open_v2 (byte[],intptr&,int,intptr) at Mono.Data.Sqlite.SOLite3.open (System.String strFilename, SOLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool) [oxo0000] in :0 at Mono.Data.Sqlite.SqliteConnection.Open () [oxo0000] in :0 at ConnectTODataBase.GetDBvalue () [oxo008b] in E:\Alireza Files\Game Project\NFS\Assets\_Scripts\ConnectTODataBase.cs:158 Error Code: Ok || Mono.Data.Sqlite.SqliteEXception: External exception
my code:
private void GetDBValue()
{
if (System.IO.File.Exists (Application.persistentDataPath + "/" + _DBName))
_txtShowUI.text += "Database Exist\n";
else
_txtShowUI.text += "Database Not Found\n";
try {
using (IDbConnection dbConnection = new SqliteConnection(StrConnection))
{
_txtShowUI.text += StrConnection + "\n";
dbConnection.Open();
_txtShowUI.text += dbConnection.State.ToString() + "\n";
using(IDbCommand dbCmd = dbConnection.CreateCommand())
{
string sqlQuery = "SELECT * FROM tbl_01";
dbCmd.CommandText = sqlQuery;
using(IDataReader reader = dbCmd.ExecuteReader())
{
while(reader.Read())
{
_txtShowUI.text += reader.GetInt32(0) + ". " + reader.GetString(1) + " " + reader.GetString(2) + "\n";
}
reader.Close();
}
}
dbConnection.Close();
}
} catch (Exception ex) {
_txtShowUI.text += ex.ToString() + "\n";
}
}
Your answer
Follow this Question
Related Questions
Unity 2019 sqlite3 connection android 0 Answers
mobile universal SQLite connection 0 Answers
Android Build Throwing SecurityException 0 Answers
I want to ask about Android developers 0 Answers
Android game: allow internet for just specific domain 0 Answers