Consider porting System.Data.OleDb to .NET Core and include it in Windows Compatibility Pack
how do using oledb?
https://docs.microsoft.com/zh-cn/dotnet/api/system.data.oledb?view=netcore-2.0
Basically OleDB is a windows (only) technology, so i can imagine (assumption) that (currently) there is no plan to migrate to Core (X-Plat).
just my 2 cent...but waiting for comments from the team...
regards Werner
Will OleDB be provided under the Windows Compatibility Pack?
System.Data Triage: We could consider porting System.Data.OleDb, but we would need to understand better:
-
What value would it bring to the table?
- We believe OLE DB support is not as widespread as ODBC across databases and operating systems
- How many customers want to port their applications or libraries to .NET Core but are blocked on not having OLE DB support? Are there reasons they cannot move to ADO.NET or ODBC?
- Are there really any performance or functional benefits in specific OLE DB providers over existing ADO.NET or ODBC providers?
-
Are there any issues blocking or making the cost of porting high?
- It is possible that the managed providers team knows this cc @saurabh500 @geleems
Moving this to Futures for the time being. We may consider prioritizing it or closing it if we gather additional feedback.
cc @ajcvickers
How many customers want to port their applications or libraries to .NET Core but are blocked on not having OLE DB support? Are there reasons they cannot move to ADO.NET or ODBC?
I was blocked from porting a feature from a legacy customer server because (AFAIK, CMIIW) ASP.NET Core MVC does not have a way of creating / reading / writing an MS Access database.
I'm under assumption that MS Access requires OLE DB.
This feature was required because the web server needs to write data to an MS Access database file, which then will be shipped to a government server via FTP file drop. 😢
If you somehow know how to query an MS Access database without OLE DB, please let me know. That knowledge is very important to me. Thanks for reading.
P.S. Thank you for porting System.Data.Odbc, it was very useful for accessing the data in a legacy DB2 server. 👍
@ryanelian I know that https://github.com/brianb/mdbtools can be used to use Access on *nix platforms.
I also have libraries that have general db access code that can be used for SqlServer, odbc, or oledb. Obviously there are portions of code that will not run unless they are on windows but it will be great to have System.Data.oledb to port the library
In our project we would like to support all .NET Framework compatible providers on windows, but on Linux, Mac just the .NET Standard compatible providers.
Is there any other ways to accomplish this behaviour without the Microsoft.Windows.Compatibility nuget package? Or we have to wait for this feature?
Thanks in advance, Ferenc
👍 .NET Core support ODBC, but ODBC driver needs to be installed possibly (OBDC Data Sources shows options). 👍 OLEDB is not supported even through Microsoft.Windows.Compatibility NuGet. 👍 The Office engines might need to be installed separately. 👍 .NET Core can call Automation like VBA through .NET. through Activator.
@feco93 @ryanelian @divega I got ODBC working by setting database file path through System DSN. Other options did not work yet.
The ability to query Windows Search is one gap for .NET Core currently. Right now Querying the Index Programmatically uses the Search.CollatorDSO provider. Windows Search doesn't appear to get much love, but it's a very useful technology and I would love to see a IQueryable provider for it if Ole DB is no longer an option.
As a datapoint, if you would consume this library please up-thumb the top comment..
OleDb used to be declared by MS by the best way to query MS SQL database (better than ODBC) at some, rather long, timeframe before .net core. There are many enterprise apps that do this. It would ease the pain of migrating such apps to .net core if this API was supported as a Platform Extension on Windows.
OleDb used to be declared by MS by the best way to query MS SQL database (better than ODBC) at some, rather long, timeframe before .net core. There are many enterprise apps that do this.
@voltcode can you provide examples of this? In .NET, from the very beginning, the recommended and simplest way to connect to SQL Server has always been SqlClient.
In other words, any customer that used System.Data.OleDb to connect to SQL Server should probably switch to SqlClient as part of the transition to .NET Core 3.0. Unless I am mistaken (and in that case I would love to know!), there shouldn't be any loss of functionality.
On the other hand, there are specific databases like Microsoft Access (aka Jet) for which the only way to connect is System.Data.OleDb. When/if we decide to port OleDb, it is most likely going to be driven by those.
A couple of questions to any application developers that has subscribed to this issue:
- What types of databases do you connect to using System.Data.OleDb?
- If alternatives are available (for example, a database-specific ADO.NET provider, or System.Data.Odbc), is there any reason you preferred to use System.Data.OleDb?
Thanks a lot.
@divega I found some of the history referenced on https://stackoverflow.com/questions/103167/what-is-the-difference-between-ole-db-and-odbc-data-sources
OLE DB can be used with non-relational data sources, and works pretty well with Excel with a db-query like API, instead of dedicated Excel interop that requires Excel to be installed. We have some code for example that uses OleDb for both SQL Server and Excel because it allowed us to use one API instead of two.
There are many .NET applications in the world that use OLE DB in some form today. Moving them to Core is very expensive, if you have to rewrite the db layer. For the new application, yes - ODBC should be used, period. Please be aware that System.Data.Odbc has been declared stable only 6 months ago for .net core/net standard.
I don't know the current status of .net core db drivers, but allowing users to re-use existing drivers should help .net core adoption.
There's also a big hole in .net core regarding SQL Server Analysis Services connectivity - AdomdClient is not really supported. I'm not sure if it is built on top of OLE DB for OLAP extension or not. If yes, then perhaps OLEDB support could improve things.
We have some code for example that uses OleDb for both SQL Server and Excel because it allowed us to use one API instead of two.
This is a really good data point @voltcode, thank you. Indeed, accessing data from Microsoft Office applications (mostly Microsoft Access, but also Excel) is one primary use case we have identified for System.Data.OleDb.
I think it is worth mentioning that the ADO.NET provider model already enables accessing the majority of the functionality in a provider-agnostic way (using the base classes in System.Data.Common or the interfaces in System.Data, and a provider factory), so you shouldn't really need to use System.Data.OleDb to access SQL Server because you wanted to use the same API you use to access data in Excel files (although that is orthogonal in your case if you still need System.Data.OleDb anyway to access the data in Excel files).
There are many .NET applications in the world that use OLE DB in some form today.
But again, can you provide specific examples besides that one application you own? Also, do you have concrete plans to port this application to .NET Core 3.0? Would you consider doing it if System.Data.OleDb was made available on .NET Core.
Sorry I insist on trying to get as real as possible here, but we are trying to leverage a finite amount of resources to get the best possible experience on .NET Core 3.0, and if we spend time porting System.Data.OleDb, very likely some else's favorite feature will have to wait :smile:
For the new application, yes - ODBC should be used, period.
Actually, if there is a database-specific ADO.NET provider you can use, that should in general be your first choice.
There's also a big hole in .net core regarding SQL Server Analysis Services connectivity - AdomdClient is not really supported. I'm not sure if it is built on top of OLE DB for OLAP extension or not. If yes, then perhaps OLEDB support could improve things.
That is a good point, but I think System.Data.OleDb won't help. If you are using the clients linked to from https://docs.microsoft.com/azure/analysis-services/analysis-services-data-providers and need the functionality to be supported on .NET Core, please create a separate issue for those.
@divega There's no way to use Windows Search in .NET Core currently as the Search.CollatorDSO provider is the only way to query the index. I assume this is also the case with PowerShell Core,
We use OLEDB to connect to a MS Access database (*.accdb via ACE) and read data from EXCEL files. We really plan to migrate to .NET Core 3 because of performance reasons. Our main application is a mix of WinForms and WPF. We suppose that because of the open sourcing of them (for .NET core but not for full framework), that future development will only happen for .NET Core. So OLEDB is the main blocker for us. We also use the Windows Search, but that feature is not vital to us. Another benefit for us would be the availability to use a more modern web browser control. All other stuff (APIs) that we use (e.g. DirectShow) is already supported.
@divega yes I have plans for migration to .net core 3, but this issue is a blocker. We have a set of applications with similar dependencies, so it's not just a single app.
Throughout ca. 10years, at customers sites I saw and maintained many apps that used OLEDB, primary use was for reading Excel files. Most of those apps work today, and cannot be moved to core because it requires too much redevelopment. It seems that this issue is mostly a child of Excel's success,the largest the data accessing capabilities, the more successful the framework is. If you ever plan to ditch .net fx, then this is one of the blockers.
@FroggieFrog thanks for your feedback. FYI you can use modern web view in WinForms/WPF running on .NET Framework using https://www.nuget.org/packages/Microsoft.Toolkit.Win32.UI.Controls/
Now that WPF runs on .NET Core, I'm going to need OleDB/Access as well. (Not that I like using Access, but there are too many legacy databases to ignore it.)
And while I currently don't need Excel in my WPF projects, that was a common requirement in the past so it wouldn't surprise me at all if I see it again in the future.
Does Access not already work through ODBC?