Access to Data

Most business applications deal with data. Traditional Visual Basic applications have implemented code to work directly with the database. The database could be local, or on a mapped network drive, such as a Microsoft Access database. Others would be maintained by an actual database server such as Microsoft SQL Server or Oracle.

Visual Basic hasn't always had easy access to databases. In fact, it wasn't until Visual Basic 3.0 that we had easy access to databases - through a data access model and the infamous data control. Using the JET database engine,we could finally open up databases and work with the data using native elements of the Visual Basic language. Through JET we even had access to SQL database servers through Open Database Open Database Connectivity (ODBC).

The JET engine worked well enough to create two-tier client/server applications, but it tended to be slow and inflexible. There was no easy way to tap into the power of the SQL database server from our applications. Without resorting to direct calls to the ODBC API, or using proprietary database libraries, there was no way to avoid the use of the JET engine for database access.

Visual Basic 4.0 added a couple of important capabilities Remote Data Objects (RDO), and an enhanced data access model in the form of Data Access Objects (DAO). RDO is a thin object layer built on top of the ODBC API that provides a substantial performance boost over JET - as well as giving us more capabilities to use the power of a database server. The enhanced DAO with Visual Basic 4.0 offered powerful new capabilities for working with Access databases, but provided little help for dealing with ODBC data sources.

Now, with Visual Basic 5.0, we have even more capabilities. RDO 2.0 offers even more powerful and faster access to ODBC data sources. We can use the familiar DAO model to efficiently access ODBC data sources using ODBCDirect. ODBCDirect provides us with the same DAO object model we use for Access databases, but it uses RDO behind the scenes to provide us with significant performance benefits.

Even more importantly, Visual Basic 5.0 allows us to create components. These components can be run on the user's workstation, on the database server, or on an application server sitting in the middle. Using the current data access technologies, such as RDO and ODBCDirect, we can create components that interact with the database. We can then use those components to develop our applications - and the application won't have to know about or deal with any database issues at all. We'll get into a lot more detail through the remainder of this chapter and at various points throughout the book.

© 1997 by Wrox Press. All rights reserved.