Featured

    Featured Posts

Database Connectivity in Visual Basic

Visual Basic provides many different methods for accessing data :
  1. Data Access Object (DAO).
  2. Remote Data Object (RDO).
  3. Activex Data Object (ADO).
  4. Data Bound Controls (DBC).
Data Access Object (DAO) enables us to use a programming language to access and manipulate data in local or remote databases and to manage databases, their objects & their structure.
DAO supports two different database environments or workspaces :->
i) The first is Microsoft Jet workspaces, which includes connecting the Jet databases via ODBC driver.
    Also, there is ISAM ( Indexed Sequential Access Method ) databases.  Such as MS-Excel and Paradox.  Use the Microsoft Jet workspaces, when we open a Jet database (.mdb file of Access) or other ISAM database (Excel or Paradox).
ii)  The second is ODBC direct workspaces which provide an alternative, when we only need to execute queries and stored procedures against a back end server such as Oracle or MS SQL server.

      This means with DAO we can access ISAM (Excel or Paradox) as well as relational databases (such as Oracle) with ease because DAO  shields/protects the developer from many complexities and creates a layer whee the ceveloper can use a common code base to interact with multiple back ends.  In other words, the developer can use the same code to interact with both SQL server and Fox Pro.
        DAO was originially implemented with Microsoft Jet database engines, which then interacts with ODBC driver manager.  The ODBC driver manager handles all low level interactions with the database.  While the jet engine is flexible, it loses in performance because it forms a thick layer between our applications and the data, slowing down the data access.
       So, VB added ODBC Direct to DAO in version5.  ODBC Direct allows accessing of ODBC database through the RDO with DAO objects, by passing Jet database engine.


DAO Object

DB Engine object is at the top.  It contains the workspace collection, which consists of individual work space  objects.  The work space objects includes databases collections.  The database object includes Recordsets among other collections.
      A recordset object is an active result set from the database suppose that we are executing a query from the client machine.  The result is available to us as a Recordset.

Remote Data Object (RDO) :-> 

      RDO provides an information model for accessing remote data sources through ODBC.
      RDO introduced in version4, provided a major performance boost for client/server applications.  RDO provides a framework for using code to create and manipulate components of a Remote ODBC database system RDO offers a set of objects that make it easy to connect to a database, execute queries and stored procedures, manipulate results and commit changes to the server.

RDO Object Model :->

The RDO object hierarchy is simpler but similar to that of DAO.
* RDO Engine is at the top of the hierarchy.  This object has a collection of RDO Environment objects.
* The RDO Environment object contains RDO Connection collection.
* The rdoConnection object contains rdoResultsets collection among other collection.
Advantages of RDO :->
  1. It puts smaller layer between the application and the data.
  2. Query processing is done remotely, so there is no need for a local query processor such a Jet.
  3. Event driven asynchronous queries.
In case of DAO, programs has to wait for the Resultset to be returned before processing con continue this is called synchronous querying.
   But RDO permits asynchronous queries.  It means when the query is complete and the result is completely populated, an event is fired, providing an event-driven means for the applications to know that the query has completed.

Post a Comment

www.CodeNirvana.in

www.posthatke.com. Powered by Blogger.
Copyright © www.posthatke.com | Blogger Templates | Designed By posthatke.com