ORACLE/SQL Distributed Systems: A Development Guide for C Programmers is a tool for C programmers who want to embed Structured Query Language (SQL) statements into their programs, for access to local or remote (distributed) databases. It is useful to programmers and analysts working with relational database management systems such as Oracle, who desire the added flexibility that C affords. For all computer users, it provides a hands-on introduction to the client-server model of distributed processing, and the essentials of data communications that ensure the reliable functioning of systems built to this model.

By distributed application, we mean an application that runs on a PC but maintains its data at a remote central computer. The PC handles the user interface and performs most of the actual processing. The central computer stores data and makes it accessible to multiple application programs.

During the course of the book, a working distributed system is developed. Complete C code is provided for:

* an interesting sample game (client) application, meTTTa, that learns as it plays, by saving the results of previous games in a relational database. It demonstrates the principles, and makes use of the tools developed in the chapters. The game application makes effective use of PC graphics on the client node, and offloads all database accesses to a remote server.

* an SQL server process that services requests from remote client processes to Oracle's relational database manager. Written in American National Standard Institute (ANSI) standard C, the server has been tested under MS-DOS, VAX VMS and Data General AOS/VS.

* a suite of protocols that perform packetizing, error-correction, and flow control to promote reliable real-time communication between client and server processes.

* a precompiler that converts embedded SQL, within client processes, into communications function calls.

In presenting the sample game application, meTTTa, ORACLE/SQL Distributed Systems: A Development Guide for C Programmers breaks from the business application usually employed in books on SQL or databases. The theme evolves through a simple game that all readers will immediately recognize. meTTTa employs the game of Tic Tac Toe which provides a surprisingly rich environment within which to develop a complete distributed system. The concepts and techniques developed here are readily transferable to business or other real-world applications.

SQL is a non-procedural language that is fast becoming the standard vehicle for manipulating data, such as that found in relational databases. Application programs, including many written in C, make insert, update, delete and query requests of a database manager using the SQL language. Many vendors, including the market leader, Oracle Corporation, provide environments in which to develop SQL-based applications.

C is the dominant procedural programming language in today's marketplace. It permits almost any imaginable processing of data, and facilitates the inclusion in computerized systems of such features as graphic user interfaces and data communication sub-systems.

Key concepts developed in this book include:

* distributed SQL using the client-server model

* modular C programming


* the data communications components needed to support a distributed architecture

* relational databases, with the focus on Oracle

* graphic user interfaces on PCs

* machine learning

The concepts in Oracle/SQL Distributed Systems: A Development Guide for C Programmers are developed in four parts.

Part I introduces the environment and the sample application. The rest of the book is built on this foundation.

Chapter 1 describes the basic environment assumed by the book, and the programming tools required.

Chapter 2 constructs and explains the baseline version of the sample application, meTTTa, written entirely in Microsoft C. This version has no separate database but demonstrates a simple graphic interface. meTTTa is a self- contained sample application controlled by a single human user. In broad concept, it resembles many PC game, business and other applications that maintain their own data.

Part II introduces SQL, Oracle's SQL toolset, and the use of SQL within C programs. It concludes with an enhanced sample application that learns strategy by saving previous games in an Oracle database. The C program from part I is modified by adding embedded SQL statements and additional graphics.

Chapter 3 introduces the syntax of Structured Query Language (SQL), and its use as a stand-alone language to query, insert, update and delete data from relational databases. Current products that incorporate SQL are discussed.

Chapter 4 describes Oracle, the current market leader in the field of SQL-based database management and application development products. Oracle provides full support for C programs with embedded SQL.

Chapter 5 demonstrates the use of SQL within C programs, and goes through the entire edit, precompile, compile and link cycle. It provides a thorough discussion of Oracle's Pro*C product.

Chapter 6 constructs and explains the intelligent version of the sample application, SQL meTTTa, complete with embedded SQL and graphics.

Part III takes advantage of the inherent nature of SQL to run applications such as meTTTa in a multi-user distributed environment. The database and database manager are moved to a remote minicomputer or other multi-user (server) system, while the game with its graphics user interface continues to run unchanged on the (client) PC. A data communications sub-system is developed to provide a reliable link between the client and server processes.

Chapter 7 describes the client-server model, including Oracle's approach.

Chapter 8 develops the C code for a complete general purpose Oracle-based SQL server. It includes a discussion of dynamic SQL, a powerful component of ANSI standard SQL implemented within Oracle, IBM's DB2 mainframe database, and other vendors' SQL products.

Chapter 9 introduces the basic concepts of data communications. It describes the Open Systems Interconnection (OSI) model for data communications systems that's been accepted by virtually all computer and communications vendors.

Chapter 10 explains a simple data communications sub-system that is able to reliably transfer SQL statements from client to server, and return the results of queries back to the client. It develops the C code for several communication layers based on the principles of the Open Systems Interconnection (OSI) model.

Chapter 11 provides the program listing and brief explanations for an SQL precompiler that automatically converts C programs, with embedded SQL, into versions that make use of a communications network to access a remote SQL server.

Chapter 12 integrates all of the above into a complete client-server system.

Part IV suggests extensions to concepts developed earlier in the book. It challenges the reader to journey beyond the basics of distributed SQL.

Chapter 13 proposes a Kermit-like set of protocols to support distributed database accesses, as replacements for the demonstration protocols used in this book.

Chapter 14 proposes a generalized approach to an SQL "terminal" that accesses remote database tables through separate windows on the PC.

Chapter 15 describes a C program that will run an Oracle SQL*Forms application on a PC, but without SQL*Forms or any other PC-based Oracle product.

Chapter 16 discusses the incorporation of limited parallel processing into client applications, by letting processing continue while waiting for responses from the remote SQL server.