The lowest level connects to the database and performs the actual operations required by the users. At this level the conceptual instruction has been translated into multiple instructions that the database understands. Executing the instructions in the correct order allows the DAL to perform the conceptual instruction.
Implementation of the physical layer may use database-specific APIs or use the underlying language standard database access technology and the database's version SQL.
Implementation of data types and operations are the most database-specific at this level.
The conceptual level consolidates external concepts and instructions into an intermediate data structure that can be devolved into physical instructions. This layer is the most complex as it spans the external and physical levels. Additionally it needs to span all the supported databases and their quirks, APIs, and problems.
This level is aware of the differences between the databases and able to construct an execution path of operations in all cases. However the conceptual layer defers to the physical layer for the actual implementation of each individual operation.
The external level is exposed to users and developers and supplies a consistent pattern for performing database operations. 3 Database operations are represented only loosely as SQL or even database access at this level.
Every database should be treated equally at this level with no apparent difference despite varying physical data types and operations.
Libraries unify access to databases by providing a single low-level programming interface to the application developer. Their advantages are most often speed and flexibility because they are not tied to a specific query language (subset) and only have to implement a thin layer to reach their goal. As all SQL dialects are similar to one another, application developers can use all the language features, possibly providing configurable elements for database-specific cases, such as typically user-IDs and credentials. A thin-layer allows the same queries and statements to run on a variety of database products with negligible overhead.
Popular use for database abstraction layers are among object-oriented programming languages, which are similar to API-level abstraction layers. In an object-oriented language like C++ or Java, a database can be represented through an object, whose methods and members (or the equivalent thereof in other programming languages) represent various functionalities of the database. They also share advantages and disadvantages with API-level interfaces.
An example of a database abstraction layer on the language level would be ODBC that is a platform-independent implementation of a database abstraction layer. The user installs specific driver software, through which ODBC can communicate with a database or set of databases. The user then has the ability to have programs communicate with ODBC, which then relays the results back and forth between the user programs and the database. The downside of this abstraction level is the increased overhead to transform statements into constructs understood by the target database.
Alternatively, there are thin wrappers, often described as lightweight abstraction layers, such as OpenDBX4 and libzdb.5 Finally, large projects may develop their own libraries, such as, for example, libgda6 for GNOME.
Ambler, Tim; Cloud, Nicholas (2015). JavaScript Frameworks for Modern Web Dev. Apress. p. 346. ISBN 978-1-4842-0662-1. 978-1-4842-0662-1 ↩
"What is database-agnostic? - Definition from WhatIs.com". http://searchdatamanagement.techtarget.com/definition/database-agnostic ↩
"Levels of Abstraction". http://www.dmst.aueb.gr/dds/etech/db/abstr.htm ↩
"OpenDBX". linuxnetworks.de. 24 June 2012. Retrieved 26 July 2018. https://www.linuxnetworks.de/doc/index.php?title=OpenDBX ↩
"Libzdb". tildeslash.com. 2018. Retrieved 26 July 2018. https://www.tildeslash.com/libzdb/ ↩
"GNOME-DB". 12 June 2015. Retrieved 26 July 2018. Libgda library [...] is mainly a database and data abstraction layer, and includes a GTK+ based UI extension, and some graphical tools. http://www.gnome-db.org/ ↩