DAAB & ODBC throws ConfigurationErrorException

Topics: Data Access Application Block, Enterprise Library Core
May 16, 2007 at 1:00 PM
I'm new to the Enterprise Library and .NET in general, so this is probably a stupid question.

I can't seem to get the DAAB to connect to an ODBC datasource; I get a ConfigurationErrorsException "Configuration system failed to initialize".

Dim db As GenericDatabase = DatabaseFactory.CreateDatabase()

But if I change "GenericDatabase" to "Database" and change the app.config to point at a SQL server database, it works fine.

The app.config reads as follows:
<section name="dataConfiguration" ... />
<dataConfiguration defaultDatabase="myDB"/>
connectionString="DSN=mydb;" />

What am I missing?
May 16, 2007 at 1:48 PM
This is an example I cooked up to show connecting to Microsoft Access using OleDb and ODBC and may get you started:

Using Enterprise Library DAAB and Microsoft Access 2007 via ODBC and OLEDB - Connection Strings and ADO.NET




David Hayden
Microsoft MVP C#
May 16, 2007 at 3:00 PM
Thanks. I already knew most of the stuff covered in the article (or at least I thought I did :-), but it got me started down the right path. It turns out I needed to tweak my connection string. Once I did that, the errors went away.

But I still don't understand why this works, or why what I had before didn't. If providerName="System.Data.Odbc", shouldn't I just be able to specify a data source I've set up in the ODBC Admin applet?

I guess there's a good reason why there are entire articles and Web sites devoted to connection strings. Is there some documentation on how to construct a connection string? (Not connectionstrings.com -- I'm looking for something like a list of keywords, dependencies on the underlying driver, etc.)