[MonoDevelop] ODBC/UnixODBC

Petit Eric surfzoid at gmail.com
Sat Dec 20 06:55:56 EST 2008

I'm trying a sample to connect to a mdb Access database (read only)
with mdbtool/libodbcmdb.
I see a first error in Mono ODBC managment, in the connection string,
the driver is in bracket like that Driver={Microsoft Access Driver
(*.mdb)} , but this give an Unhandled Exception:
System.Data.Odbc.OdbcException with Database not found or Driver not
specified, without bracket it is okay but don't folow the same way as

The libodbc.so from devel package seem requiere, why a devel pkg for a
runtime, is there a way to use the libodbc.so.1.0 from normal rpm ?

Now let's see my sample :
using System;
using System.Data;
using System.Data.Odbc;
using System.Windows.Forms;

namespace TestMdbCle
	class MainClass
		public static void Main(string[] args)
			Frm.Shown += new EventHandler(Form1_Shown);
	static string CntStr = "Driver=Microsoft Access Driver
	//static string CntStr = "DSN=test;Uid=Admin;Pwd=bfadi.;";
	static Form Frm = new Form();
	static void BuildDtObjs()
		DataGridView DtG = new DataGridView();
		OdbcConnection Cnt = new OdbcConnection(CntStr);
		OdbcDataAdapter DtAdpt = new OdbcDataAdapter("SELECT * FROM Affaires", Cnt);
		DataSet Ds = new DataSet();
		DtG.DataSource = Ds;
		DtG.DataMember = Ds.Tables[0].TableName;


        private static void Form1_Shown(object sender, EventArgs e)


When trying to Fill data in the Dataset i get :

Unhandled Exception: System.Data.Odbc.OdbcException: ERROR [IM004]
[unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV
  at System.Data.Odbc.OdbcConnection.Open () [0x00263] in

I'm not able to go more far, any idea ?


Small Eric Quotations of the days:
If one day one reproaches you that your work is not a work of
professional, say you that:
Amateurs built the arch of Noah, and professionals the Titanic.

Few people are done for independence, it is the privilege of the powerful ones.

No key was wounded during the drafting of this message.

More information about the Monodevelop-list mailing list