ActiveX Data Objects (ADO) In Visual C++ - The Myriad of Data Access Technologie

Started by ganeshbala, Apr 21, 2008, 06:29 PM

previous topic - next topic
Go Down

ganeshbala

The Myriad of Data Access Technologies

Applications are created to interact with data sources. When I say data source, I could mean excel sheets, indexed sequential data files, text files etc. Applications use different data access techniques to extract data from data sources. These techniques should be easy to use, and there mustn't be complex deployment issues associated with them. They should perform well in terms of using the smallest amount of processing power.

These issues led to the development of Universal Data Access (UDA) by Microsoft. UDA was based on COM and aimed to provide high performance data access to various data sources.

Even today, we have various data access technologies available. Some of them are:

    * ODBC (Open Database Connectivity): ODBC is a set of programming API's, which allows you to connect to a variety of data sources. Prior to ODBC we used to have DB-Libraries. The one flaw with DB-Libraries was that they were optimized to access data from a specific source, which made the application very dependent on the database used. On the other hand, ODBC could interact with various data sources using a common set of code.
    * DAO (Data Access Objects): DAO was a technology that was used to extract data from Jet Databases.
    * RDO (Remote Data Objects): RDO was a thin layer of API over ODBC. It was somewhat like an add-on for ODBC.
    * OLEDB: OLEDB is a system level API created by Microsoft, which uses its Universal Data Access strategy. It can extract data from relational and non-relational data sources.
    * ADO (ActiveX Data Objects): ADO is an enhanced version of DAO and RDO. ADO uses the OLEDB technology to gain access to any kind of data. You can interact with OLEDB directly but that would be difficult in any language that doesn't support pointers, such as Visual Basic. As OLEDB is at the system level, you would have to take care of many things like memory management, object creation and destruction and other system level purposes. ADO is entirely based on COM. It's a high level interface for using OLEDB. ADO provides us with an object oriented API to interact with a data source.

ADO consists mainly of three objects. The Connection, Command and RecordSet Objects:

Connection: This object is responsible for the connection to the data source. It encapsulates the details of a connection to the data source. You would have to supply the necessary details to this object in order to connect to the data source. All this information is bundled into one line called the ConnectionString. The open method of the Connection object accepts the ConnectionString as a parameter.

Command: This object is responsible for executing SQL statements and stored procedures.

Recordset: This object is responsible for storing the results returned by the data source. The recordset object also maintains all locking issues at the program level, NOT at the database level. Again, the data in the record set can be manipulated which in turn will be manipulated in the database.

Smart Pointers
I would also like to explain another concept before we proceed. It's about something called smart pointers. Smart pointers were made primarily to make programming a lot simpler. A smart pointer is a class that contains a pointer to another object. When you make an object of the smart pointer and call its methods, you are actually calling the methods of the interface, which is encapsulated in the smart pointer.

The smart pointer overrides the -> operator, which we use to call its methods. The smart pointer would ask you for the CLSID of the class which we want to use. Calling the CoCreateInstance method to create the object and other information related to creating the object is all encapsulated.

If smart pointers sound confusing then hopefully the code in the next couple of pages in this article will help to explain how they work.

Before you proceed, make sure you have worked with Visual C++ before to understand the following steps.

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:
Verification:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens Web Designing Chennai | GinGly :: Build your Personal Website | CineBuzz :: Cinema News | My Kids Diary :: Kids Memories Writing :: Book Website @ 349 Rs monthly
Copyright 2005 - 2020 :: IT Acumens :: All Rights Reserved. :: Sitemap
ITAcumens Discussion Forum with 2 lakhs post running for 15 years - Powered by IT Acumens Dedicated Server