5
votes

ORM (Object Relational Mapping)
It looks like a model that packages operation of relational database, such as MySQL, as object and provides programmatic method (e.g. object.getMax()) for manipulating database in program.

ODBC (Open Database Connectivity)
It seems to be a connector between different databases.

For instance, LIQN, is belong which one? Is ODBC a implementation of ORM?

3

3 Answers

4
votes

These are two very large things, but I will give you a cursory overview...

Open Database Connection is a specification to talk to data bases. It is the 'language' in which you client and database are going to talk.

ORM is a concept that quite a few tools implement. It is a concept in which objects are mapped to relational databases so that you talk to your DB in your object oriented code with objects. LINQ to SQL is an implementation of an ORM. It likely may use an ODBC type connection to perform that connection between your objects and your database.

There is a tremendous amount videos, blogs, and lessons on this.

ODBC Overview

ORM Overview

3
votes

ORM is a technique (in the abstract sense) of mapping classes and objects to relational tables. For example, without ORM, if you do an SQL query, you get a resultset containing table rows, and within those, columns. The format of the resultset is always the same, no matter if you're querying cars or personnel. With an ORM, your program gets instances of class Car or Person, ready to be used.

ODBC is a middleware API that unifies access to various data sources. It tries to iron out the differences between protocols, so that your code can connect to a number of different engines without having to worry about which protocol to use with each.

LINQ is a query language. Some of LINQ providers will be ORM, and some might access the database through ODBC; but those three are all distinct concepts.

You might write a query in LINQ, its provider might access the database through ODBC API, and return results to you as an ORM (i.e. by mapping the results to objects representing database records).

Each of those steps could be replaced by a more basic one: you could write a query in, say, PostgreSQL dialect of SQL; access the database through the PostgreSQL driver using the PostgreSQL-specific protocol; and get the data back as a collection of Rows containing a specific number of Columns.

Or you could do any combination: access through ODBC but get rows/columns; use ORM on a direct proprietary-protocol connection.

0
votes

The difference is:

  • ODBC returns recordsets as tuples

    create a new command dbhandle which is used to further manipulate the database

  • ORM returns recordsets as objects

    introspects the database to discover its primary keys and foreign key relations in order to build the cross-links between table classes

References