Cannot connect a PostgreSQL ODBC while using SCADA Connect


Product(s):WaterGEMS
Version(s):10.00.xx.xx and above

Problem

When trying to connect to the PostgreSQL ODBC while using SCADA Connect, it gives following error - 

"The .NET Framework data provider for OLEDB (System.Data.OleDb) does not support the Microsoft OLE DB provider for ODBC drivers (MSDASQL). Use the .NET Framework data provider for ODBC (System.Data.Odbc).

Solution

The .NET Framework Data Provider for OLE DB (OleDb) uses native OLE DB through COM interop to enable data access, while the .NET Framework Data Provider for ODBC (System.Data.Odbc) allows ADO to connect to any ODBC data source.

In this case if you see the error message, kindly go to the change data source and check the Data Source selected. If you see 'Microsoft Access Database File' as a selected Data Source as shown below -

Then you need to change the Data Source to 'Microsoft ODBC Data Source' as shown below - 

In SCADA Connect you also need to change the Data Source Type to 'ODBC Source'-

Note - The Connection String will be different for your connection.

You can also go through the OleDbConnection.ConnectionString Property Microsoft help article.

Once you go through the article please check the information in the 'Remarks' section (highlighted below) -

The ConnectionString is designed to match OLE DB connection string format as closely as possible with the following exceptions:

So basically when we select ODBC Source as a Data Source Type, we use System.Data.Odbc.OdbcConnection.

See Also

Using SCADAConnect Simulator