Converting an application from one database environment to another takes time, patience, and resources. Because of the differences in complexity between platforms, the conversion process would be difficult to accomplish in one step. A multiple-step conversion process provides multiple analysis points and makes the overall project development process more flexible. The strategy presented in this paper simplifies the conversion process by focusing on the different aspects of the application conversion process in stages.
This strategy provides a framework you can use when converting an application from a Btrieve-based implementation to a full ODBC and structured query language (SQL) implementation that accesses Microsoft SQL Server. Converting the application in several steps creates separate checkpoints that allow you to evaluate the status and direction of the conversion process at each stage of the project life cycle. The conversion strategy addresses the following three areas:
Figure 1 presents the application architecture implemented at each stage of the conversion process. The components of Figure 1 will be analyzed in detail throughout the next two sections of this paper.
Figure 1. The application architecture
Btrvapp.exe is the starting point. Btrvapp.exe is a simple data-entry and reporting application that maintains information about book titles, the publishers that own these titles, and sales information for each title. The application accesses two Btrieve files, Sales.btr and Titlepub.btr, through the Btrieve microkernel engine. The Sales.btr file contains sales information for each title, and Titlepub.btr maintains the title and publisher information for each title. Each of these files has two keys that correspond to a publisher and a Title ID. The application uses these keys to position itself within these files when it performs all searches. The application uses ISAM row-at-a-time searching techniques and result processing to perform its operations. Btrvapp.exe uses Btrieve concurrent transactions to manage the locks in the data file while information is updated, inserted, or deleted. The application performs the following operations:
The goal of this stage in the conversion process is to provide a layer of abstraction between the base application and Microsoft SQL Server. Using the concept of a wrapper DLL, the base application, Btrvapp.exe, will be able to access SQL Server data without modification to its code. Essentially, the wrapper will make SQL Server look like Btrieve to Btrvapp.exe. The wrapper uses Btrieve-like result set processing techniques to access two unnormalized tables, bsales and titlepublisher. These tables are structured to maintain the exact same details as the Sales.btr and Titlepub.btr files accessed by using Btrvapp.exe. Although the ODBC and SQL implementation techniques presented in the wrapper DLL are not optimal, they present an initial access methodology that is similar to Btrieve.
Odbcapp.exe is a full ODBC and SQL application that accesses SQL Server data directly. It is more efficient in the way it accesses SQL Server than the techniques implemented in the wrapper DLL. The application accesses data in three normalized tables, titles, publishers, and sales, taking advantage of the relational model provided by SQL Server. Odbcapp.exe also uses several of SQL Server's performance enhancing features such as indexes, default result set SQL, and stored procedures to process result sets.