[Mono-list] Using System.Data.SQLite from both windows and linux

Jonathan Pryor jonpryor at vt.edu
Tue Jan 19 13:53:08 EST 2010


On Mon, 2010-01-18 at 13:46 -0600, Dan Winslow wrote:
> I am trying to write a single source that can run on both windows and
> linux, and that uses Sqlite as its data storage. I am using the
> current mono build ( I built from latest tarball ).

>      1. I downloaded and installed the System.Data.SQLite ado provider
>         from phxsoftware.

There are two providers, the "managedonly" provider and the "normal"
provider.

YOU CANNOT USE THE NORMAL PROVIDER ON Mono/Linux, and I see from your
message that you're attempting to do so.

The reason being that the normal provider is a mixed-mode assembly,
bundling the native SQLite DLL with the managed ADO.NET wrapper in one
assembly.  Mono does not support these; see:

        http://www.jprl.com/Blog/archive/development/mono/2008/Jan-27.html

There are two solutions to using SQLite portably between Linux &
Windows:

1. Use the managedonly System.Data.SQLite provider.  You will then need 
   to distribute the SQLITE3.DLL native library with your app.

2. Use Mono.Data.Sqlite.  This is basically the managedonly 
   System.Data.SQLite provider with a different namespace and 
   capitalization scheme.  The advantage is that, on Linux, the assembly
   and native library are handled by the Linux distro (and thus don't
   need to be bundled with your app), but on .NET you'll need to 
   distribute both Mono.Data.Sqlite.dll and sqlite3.dll with your app
   (which is the same as with managedonly System.Data.SQLite).

 - Jon




More information about the Mono-list mailing list