ActiveX data objects (Ado). Language neutral object model that exposes data caused by an underlying OLE DB provider.
[ hide ]
- 1 General
- 2 Evolution
- 3 Operation
- 4 Components
- 1 Main
- 2 Others
- 5 Connection, recordset and command
- 1 Connection
- 2 Recordset
- 3 Command
- 6 Ado md
- 7 Sources
It is an object – oriented technology for ActiveX components based on a C ++ API called OLE DB. For developers, it has the invaluable advantage of being able to dispense with low-level OLE DB programming details when accessing data stored in relational or non-relational databases . Instead, ADO objects, being ActiveX components, can be invoked from any of the most popular languages on the Internet that work with objects to access the full power of OLE DB, but without resorting to low-level programming. ADO is part of the Microsoft Data Access Components (MDAC).
With ADO, a program can read, insert, edit, or delete the information contained in different storage areas within the database called tables. Furthermore, the database itself can be manipulated to create new areas for storing information (tables), as well as altering or eliminating existing ones, among other things. It was developed by Microsoft and is used in Windows environments by programming languages such as Visual Basic, C ++, Delphi, among others, as well as on the Web by using Active Server Pages ( ASP ), the VBScript language and others.
ADO replaced both DAO (Data Access Object) and RDO (Remote Data Object), which were the previous systems that were used to access databases and remote databases, respectively. It has most of the functionality of both models and yet is easier to use and understand and therefore easier and less cumbersome to program. The latest version of ADO, created by Microsoft , is called ADO.NET (with several versions), and is used in the programming environments of the Microsoft .NET platform , to manage databases both in Windows and on the Web through ASP.NET, which is the new version of ASP for the .NET platform.
In the free software programming platform called Mono there is also a library similar to ADO.NET, which means that ADO.NET technology can now be used in other operating systems besides Windows, such as Linux , Mac OS X , BSD , and Solaris . ADO.NET is much more powerful than ADO but it is also very different, so it is necessary to redesign the programs made with ADO, so that they work on it.
The data request process between the client and the data server works as follows:
- The client creates a Connection object to establish a data communication channel with the server.
- The client creates a Command object that will store SQL statementsto perform operations on the database.
- The Command object is sent to the server through the channel established with the Connection object.
- The server processes the SQL query contained in the Command object and results in a set of records contained in a Recordset object.
- The Recordset object is returned to the client through the established connection.
- The client receives the records and can move through them.
- New queries can be sent to the server using Command objects through the Connection object.
- The connection to the server is released.
- Connection (Allows you to establish a connection to the database)
- Recordset (Manages a set of records from the database)
- Command (Allows to send SQLcommands to be executed by the database)
- Record (It allows to handle a record generally from a different source than a database. One of its uses is the representation of data that are not structured in the form of tables, such as having a tree-like structure ).
- Field (Allows to manipulate a field belonging to a Record or a Recordset)
- Parameter (Allows you to configure a parameter for an SQL query. Used with Command)
- Stream (Allows you to manipulate data streams from textfiles , web pages , etc.)
- Error (Indicates the characteristics of errors that could occur when executing ADO object methods)
- Property (Contains information pertaining to a specific object)
Connection, recordset and command
The three main components of ADO are connection , recordset, and command (the connection, the recordset, and the command).
It is the medium that allows the flow of data between the program and the database. Through it can travel the commands that are used by the program to make requests for information to the database or to perform an operation within it such as deleting records, adding records, modifying tables, etc. Also, in this way, data can come and go, to and from the database, among other things. Both the recordset and the command use the connection to communicate with the database.
The connection communicates with the database through an intermediary called a “data provider”. All this is transparent to the ADO user , who generally does not have to know or know these mechanisms. ADO has a high degree of abstraction, which means that by maintaining a simple interface , it hides the complex details of database management.
A program can completely bypass the ADO, and access the database directly in three different ways, through OLDB, ODBC , or by ODBC using an intermediate layer of OLE DB. By working in this way, you have the advantage of greater functionality that does not contain ADO in exchange for greater complexity in programming. This is sometimes necessary, in certain types of programs and for certain needs, but it is not common.
The Recordset is a set of records. In general, your data originates from a database , although it can also be generated independently of it. A recordset can contain zero or more records. Each recordset has a collection of fields that is common to all records. It can be seen as a matrix or table, where the rows are the records, and the columns are the fields.
A recordset can have several characteristics that the scheduler can modify. For example, it can be read-only, or read-write. The information with which the recordset is loaded can come from one table or several tables, from the database. The recordset has navigation capabilities among its set of records. May:
- Move to next record
- Move to the previous one
- Move to first
- Move to last
- and others
In a recordset, you can view and edit the data of a single record in a given time, you can manipulate the data in the fields of the “current record” where it is located. In addition to editing records, you can also:
- Insert new records
- Delete records
Editing, inserting and deleting records in the recordset will be reflected in the database.
The command or command (command) is the ado component that allows making requests or giving orders to the database by means of a sql statement. You can specify inserting new records into a table, as well as deleting updating and fetching records under certain conditions. In addition, the characteristics of the tables that make up the database can be created, altered and modified.
Microsoft ActiveX data objects (Multidimensional) (ADO MD) provides easy access to multidimensional data from languages such as Microsoft Visual Basic , Microsoft Visual C ++, and Microsoft Visual J ++ . Ado md extends Microsoft ActiveX Data Objects (Ado) to include specific objects for multidimensional data, such as CubeDef and Cellset objects. With Ado md you can explore multidimensional diagrams, query data and extract the results.
Like Ado, Ado md uses an underlying OLE DB provider to gain access to data. To work with Ado md, the provider must be a multidimensional data provider (MDP-> Multidimensional Data Provider). MDPs present data in multidimensional views in the opposite way as tabular data providers (TDP) do.