I am working on a C # project that uses a SQLite3 database and needs to be cross-compatible between windows and linux.
The linux server uses version 3.2.8, and I use the Sqlite DLL 1.0.66.0 managed library.
I copied the dll to the server and when I run mono myexec.exe it displays the following error
Unhandled exception: System.EntryPointNotFoundException: sqlite3_open_v2 at (native-managed wrapper) System.Data.SQLite.UnsafeNativeMethods: sqlite3_open_v2 (byte [], intptr &, int, intptr) in System.Data.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite.SQLite. String strFilename, flags SQLiteOpenFlagsEnum, Int32 maxPoolSize, Boolean usePool) [0x00000] at: 0 at System.Data.SQLite.SQLiteConnection.Open () [0x00000] at: 0 on AudioManagement.DatabaseConnection..ctor () [0x00000] at: 0 on LinuxAudioManager.Configure.startConfiguration () [0x00000] at: 0 on LinuxAudioManager.Program.Main (System.String [] args) [0x00000] at: 0
This error occurs when trying to make a database file or open a connection, I'm not sure what it is.
Below is the code that I use to create the connection
conn = new SQLiteConnection("Data Source=database.db"); conn.Open()
Thanks for any help you can provide.
UPDATE I just ran my mono-recording program and found something rather strange. It seems to have a problem loading the lib file. Output below
Mono-INFO: DllImport is trying to load: 'libsqlite3.so.0'. Mono-INFO:
The place to download DllImport is 'libsqlite3.so.0.so'. Mono-INFO: DllImport
error loading library: 'libsqlite3.so.0.so: cannot open shared object
file: There is no such file or directory '. Mono-INFO: loading DllImport
library: './libsqlite3.so.0.so'. Mono-INFO: loading DllImport error
library './libsqlite3.so.0.so: cannot open file of shared objects: such
file or directory. "Mono-INFO: loading DllImport: 'libsqlite3.so.0'.
Mono-INFO: search for "sqlite3_open_v2". Mono-INFO: Research
'sqlite3_open_v2'. Mono-INFO: study "sqlite3_open_v2". Mono-INFO:
Research "sqlite3_open_v2A". Mono-INFO: Study "sqlite3_open_v2A".
Mono-INFO: DllImport is trying to load: 'libsqlite3.so.0'. Mono-INFO:
The place to download DllImport is 'libsqlite3.so.0.so'. Mono-INFO: DllImport
error loading library: 'libsqlite3.so.0.so: cannot open shared object
file: There is no such file or directory '. Mono-INFO: loading DllImport
library: './libsqlite3.so.0.so'. Mono-INFO: loading DllImport error
library './libsqlite3.so.0.so: cannot open file of shared objects: such
file or directory. "Mono-INFO: loading DllImport: 'libsqlite3.so.0'.
Mono-INFO: search for "sqlite3_open_v2". Mono-INFO: Research
'sqlite3_open_v2'. Mono-INFO: study "sqlite3_open_v2". Mono-INFO:
Research "sqlite3_open_v2A". Mono-INFO: Study "sqlite3_open_v2A".
The libsqlite3.so.0 file exists, but I cannot understand why mono is trying to download libsqlite3.so.0.so.
UPDATE 2 I think the first update error messages were pointing me in the wrong direction, as I created a symbolic link to match where it could not find the lib file, and mono no longer says that it cannot load something . However, the original value of EntryPointNotFoundException is still displayed
UPDATE 3 Thanks to @bryanmac, I changed the code to use the Mono.Data.Sqlite dll instead, which works fine on Linux under mono. However, using this DLL on Windows no longer works. VS2010 will build it without problems, but when I try to execute it, it will display an error
Unable to load DLL 'sqlite3': the specified module was not found
I downloaded the sqlite3.exe binary from the sqlite site and the executable to my program's executable, but my program still displays an error message in Windows.