Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's difference between ORM and ODBC?

Tags:

orm

odbc

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?

like image 724
Veck Hsiao Avatar asked Jun 11 '14 00:06

Veck Hsiao


People also ask

What is the difference between ORM and SQL?

SQL requires developers to work directly with code. That means it's often easier for them to carry out low-level troubleshooting because they can see exactly what queries got them to a certain point. ORM works with a layer between the developer and the code, so it's not easy to see what's happening in the background.

What is difference between ORM and ODM?

An ORM maps between an Object Model and a Relational Database. An ODM maps between an Object Model and a Document Database. MySQL is not an ORM, it's a Relational Database, more specifically, a SQL Database. MongoDB is not an ODM, it's a Document Database.

What does ORM mean in database?

Object-relational mapping (ORM) is a technique that creates a layer between the language and the database, helping programmers work with data without the OOP paradigm.

What is an ORM used for?

An ORM, or Object Relational Mapper, is a piece of software designed to translate between the data representations used by databases and those used in object-oriented programming.


2 Answers

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

like image 76
TheNorthWes Avatar answered Oct 17 '22 15:10

TheNorthWes


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.

like image 24
Amadan Avatar answered Oct 17 '22 15:10

Amadan