I'm using SQLite as database engine in my app, but at the same time the application must be cross-platform, so i have decided to use Mono.Data.Sqlite. And this what i did:
-
Installed the latest version of Mono (4.0.2 SR 2), copied Mono.Data.Sqlite.dll from Mono's directory (net4_5) to my project in Visual Studio 2015
-
Downloaded and copied precompiled sqlite3.dll library.
And then i wrote a simple app:
const string databaseFileName = "somedata.db";
var path = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + databaseFileName;
if (!File.Exists(path)) SqliteConnection.CreateFile(databaseFileName);
var connString = string.Format("Data Source=file:{0}", databaseFileName);
using (var conn = new SqliteConnection(connString))
{
conn.Open();
/* Some code */
conn.ChangePassword("testpassword");
conn.Close();
}
But i'm facing with some issues:
-
First, when i'm using Data Source=file:{0} in connection string, it throws an exception: "URI formats are not supported". Replacing it to URI=file:{0} helps, but why the first option doesn't work?
-
Second, when i call conn.ChangePassword("testpassword") it throws an exception: System.EntryPointNotFoundException: Unable to find an entry point named "sqlite3_rekey" in DLL "sqlite3"
-
Third, using URI=file:{0};Password=testpassword with the already encrypted database throws an exception: System.EntryPointNotFoundException: Unable to find an entry point named "sqlite3_key" in DLL "sqlite3"
It doesn't actually happen with official wrapper for SQLite, but happens with Mono's.
P.S. Mono's wrapper works normally when i don't use encryption and Data Source=file:{0} instead of URI=file:{0}
Aucun commentaire:
Enregistrer un commentaire