Sample Application–Procedure Server

This chapter describes the PROCSRV.EXE sample application that is provided with your Open Data Services package. It describes programming considerations for creating your own procedure server applications, explains how to use the features of the PROCSRV sample application, and includes a listing of the PROCSRV source code. For the most current version of the sample code, refer to the version that shipped with your software.

The PROCSRV sample application demonstrates how to implement stored procedures in an Open Data Services server application. PROCSRV provides the following procedures for use by clients and servers in the SQL Server environment:

PROCSRV
procedure

Function
diskfree Allows the caller to specify a drive letter as a stored procedure output parameter and returns the amount of available disk space as a stored procedure return value.
disklist Obtains a list of available disk drives from the operating-system environment in which the Open Data Services server application is running and returns the available disk space for each drive as a SQL Server relational results set.
proclist Returns a list of the procedures available in PROCSRV.
scan_xbase Returns the contents of a dBASE-format file as a SQL Server relational results set.
sp_exec Executes any command string in the operating-system environment in which the Open Data Services server application is running.

The procedures in the PROCSRV sample application implement many of the features described in Overview. The procedures are similar to the extended stored procedures covered in Sample Application¾Extended Stored Procedures. Note, however, that PROCSRV runs as a separate network server application; extended stored procedures run as part of SQL Server.

Open Data Services includes two versions of the PROCSRV application:

PROCSRV implements both a remote stored procedure event handler and a language event handler: