This page is likely outdated (last edited on 06 Sep 2005). Visit the new documentation for updated content.


Table of contents


Current Status

  • Not actively maintained. Please use another managed provider, System.Data.Odbc, or GDA# instead.

  • The OleDb provider is working with libgda. The C-Sharp bindings to libgda currently work - meaning they can compile, run, and you can connect to a PostgreSQL database via libgda via the C-Sharp bindings to libgda.

  • Basic functionality (execution of commands, data retrieval, transactions, etc) are now working.

  • An inital implementation of GetSchemaTable() for the OleDbDataReader has been checked into cvs. GetSchemaTable() isn’t correct for OleDb, but the foundation is there.

Action plan

  • Does not work on Widnows because libgda does not work on Windows. Some people have tried it, but I could not verify this myself.

  • Only works on Linux with GNOME 2.x

  • Need to make the OleDb provider compatible with the OleDb provider in Microsoft .NET

Testing OleDb with libgda’s PostgreSQL provider


  • Requires a working mono and mcs

  • Requires Linux because the OleDb provider uses libgda and libgda only works on Linux.

Connection String Format

  • Connection String format:

providerName is the name of the Provider you use, such as, PostgreSQL, MySQL, etc. The elipsis … means that the connection parameters are dependent upon the provider being used and are passed to libgda for connecting. Such paramters, can be: Database, User ID, Password, Server, etc…

  • See the test TestOleDb.cs found at mcs/class/System.Data/System.Data.OleDb

C# Example

 using System;
 using System.Data;
 using System.Data.OleDb;
 public class Test
    public static void Main(string[] args)
        // there is a libgda PostgreSQL provider
       string connectionString =
          "Provider=PostgreSQL;" +
          "Addr=;" +
          "Database=test;" +
          "User ID=postgres;" +
       IDbConnection dbcon;
       dbcon = new OleDbConnection(connectionString);
       IDbCommand dbcmd = dbcon.CreateCommand();
       // requires a table to be created named employee
       // with columns firstname and lastname
       // such as,
       //        CREATE TABLE employee (
       //           firstname varchar(32),
       //           lastname varchar(32));
       string sql =
            "SELECT firstname, lastname " +
            "FROM employee";
       dbcmd.CommandText = sql;
       IDataReader reader = dbcmd.ExecuteReader();
       while(reader.Read()) {
            string FirstName = (string) reader["firstname"];
            string LastName = (string) reader["lastname"];
            Console.WriteLine("Name: " +
                 FirstName + " " + LastName);
       // clean up
       reader = null;
       dbcmd = null;
       dbcon = null;
  • Building C# Example:
  • Save the example to a file, such as, TestExample.cs

  • Build:
mcs TestExample.cs -r:System.Data.dll
  • Running the Example:
 mono TestExample.exe