Bug 26637 - Mono.Data.SqliteConnection does not support passing the DataSource with inverted commas (apostrophe)
Summary: Mono.Data.SqliteConnection does not support passing the DataSource with inver...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Data.Sqlite ()
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-02-02 10:40 UTC by Stefan K
Modified: 2015-02-02 10:59 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 26637 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Stefan K 2015-02-02 10:40:54 UTC
If i create a SqliteConnection using the following connection string:

data source='/storage/sdcard1/Android/data/example/data/example/database/database.db';Version=3;FailIfMissing=True;

The connections failes with an exception. But if I remove the inverted commas:

data source=/storage/sdcard1/Android/data/example/data/example/database/database.db;Version=3;FailIfMissing=True;

It works like a charm.

The default sqlite.org implementation targeting the .NET Framework 4.5.1 will allow inverted commas. The Mono implementation seem to ignore them and produce an error instead.
Comment 1 Jonathan Pryor 2015-02-02 10:59:01 UTC
This is a bug with Mono.Data.Sqlite:

> $ MONO_OPTIONS=--debug csharp -r:Mono.Data.Sqlite
> csharp> using Mono.Data.Sqlite;
> csharp> var c = new SqliteConnection("data source='/Users/jon/foo.db3'");
> csharp> c.Open();
> Mono.Data.Sqlite.SqliteException: Unable to open the database file
>   at Mono.Data.Sqlite.SQLite3.Open (System.String strFilename, SQLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool) [0x0009e] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs:143 
>   at Mono.Data.Sqlite.SqliteConnection.Open () [0x002aa] in /private/tmp/source-mono-mac-3.12.0-branch-32/bockbuild-mono-3.12.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.12.0/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConnection.cs:888 

Using a connection string that doesn't use apostrophes works as expected.