1 * SQL Lite Data Provider
4 <li>ADO.NET Data Provider for
5 the <a href"http://www.hwaci.com/sw/sqlite/">SQL Lite</a> which
6 is an embeddable SQL database engine</li>
8 <li>From the SQL Lite web page: SQLite is a C library that
\r
9 implements an embeddable SQL database engine. Programs that link with
\r
10 the SQLite library can have SQL database access without
\r
11 running a separate RDBMS process. The distribution
\r
12 comes with a standalone command-line access program (sqlite) that
\r
13 can be used to administer an SQLite database and which serves
\r
14 as an example of how to use the SQLite library. SQLite is not a client library
\r
15 used to connect to a big database server. SQLite is the server. The SQLite
\r
16 library reads and writes directly to and from the database files on disk.</li>
\r
18 <li>SQL Lite can be downloaded
19 from <a href="http://www.hwaci.com/sw/sqlite/download.html">here</a>.
20 binaries exist for Linux and Windows. sqlite.dll on Windows
21 and sqlite.so on Linux. The source code is available too.</li>
23 <li>Exists in namespace and assembly Mono.Data.SqliteClient</li>
25 <li>Created by Vladimir Vukicevic so he could have a database of
26 thumbnail images for mPhoto. mPhoto is GUI application
27 for cataloging images. mPhoto runs on Mono
28 and uses <a href="http://www.go-mono.com/gtk-sharp.html">GTK#</a> for its GUI.</li>
30 <li>Bugs with Mono or the data provider should be reported
31 in Mono's Bugzilla <a href="http://bugzilla.ximian.com/">here</a>. If you
32 do not have Bugzilla user account, it is free
34 create one <a href="http://bugzilla.ximian.com/createaccount.cgi">here</a>.</li>
41 <li>Able to connect, execute commands, and retrieve data...</li>
43 <li>Works in mPhoto by providing access to a SQL Lite database to store images.</li>
49 <li>Create a DataAdapter for SQL Lite named SqliteDataAdapter that can be used to
50 Fill a DataTable in a DataSet</li>
52 <li>Get the method GetSchemaTable() in class SqliteDataReader to return a DataTable
59 <li>Have a working mcs and mono</li>
61 <li>Make sure Mono.Data.SqliteClient.dll was built and is installed
62 in the same place as the mono class libraries.</li>
64 <li>If you do not have <a href"http://www.hwaci.com/sw/sqlite/download.html">SQL Lite</a>,
65 download it. There are binaries for Windows and Linux.</li>
67 <li>There is a test named SqliteTest.cs found at mcs/class/Mono.Data.SqliteTest/Test</li>
69 <li>Has a connection string format of "URI=file:some/path". For example,
70 the connection string "URI=file:SqliteTest.db" will use the database file
71 named SqliteTest.db, if it does not exist, the file will be created.</li>
77 using Mono.Data.SqliteClient;
81 public static void Main(string[] args)
83 string connectionString = "URI=file:SqliteTest.db";
85 dbcon = new SqliteConnection(connectionString);
87 IDbCommand dbcmd = dbcon.CreateCommand();
88 // requires a table to be created named employee
89 // with columns firstname and lastname
91 // CREATE TABLE employee (
92 // firstname varchar(32),
93 // lastname varchar(32));
95 "SELECT firstname, lastname " +
97 dbcmd.CommandText = sql;
98 IDataReader reader = dbcmd.ExecuteReader();
99 while(reader.Read()) {
100 string FirstName = (string) reader[0];
101 string LastName = (string) reader[1];
102 Console.WriteLine("Name: " +
103 FirstName + " " + LastName);
116 <li>Building C# Example:
118 <li>Save the example to a file, such as, TestExample.cs</li>
121 mcs TestExample.cs -r System.Data.dll \
122 -r Mono.Data.SqliteClient.dll
125 <li>Build on Windows via Cygwin:
127 mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
129 -lib:C:/cygwin/home/MyHome/mono/install/lib \
131 -r Mono.Data.SqliteClient.dll
136 <li>Running the Example: