ODBC vs OLE

  • Thread starter Thread starter Dom
  • Start date Start date
D

Dom

Can anyone give me a quick definition of the two that explains how
they differ? I especially want to know when to use one instead of the
other. For example, which is better if I want to open /read /edit /
write an MSAccess file?

Also, am I right in thinking that the DBConnection class is just there
to be inherited, and that you would never use that directly?
 
Dom,

OleDb and ODBC are generally the same thing. They are frameworks that
are in place which help abstract the mechanism which you would access
disparate data sources with. They provide a standard interface which
depends on provider implementations which help with getting the data from
the particular data source.

For working with Access files, I would recommend using OleDb, through
the System.Data.OleDbNamespace.

If you are working with a database provider which can change for your
application, then using the DbConnection class is a good idea. You would
have a factory method which would return the DbConnection instance for the
database you are working with.

However, if you know that your application will only ever work with
Access, then working with the classes in the System.Data.OleDb namespace
directly would be fine.
 
Dom said:
Can anyone give me a quick definition of the two that explains how
they differ? I especially want to know when to use one instead of the
other. For example, which is better if I want to open /read /edit /
write an MSAccess file?

The very short version:

ODBC is a C database API encapsulating the differences between database
specific database API's dating back from the early 90's.

OLE DB is a COM database API encapsulating the differences between
database specific database API's dating back from the late 90's.

It is possible to use ODBC from OLE DB.

Both ODBC and OLE DB can be used from .NET.

The preferences for a .NET developer should be:
1) .NET provider
2) OLE DB provider
3) ODBC driver

For Access you will need to settle for #2.
Also, am I right in thinking that the DBConnection class is just there
to be inherited, and that you would never use that directly?

DBConnection is abstract so you will always have a sub class of it.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top