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:
The event handler checks for the existence of the procedure name, runs the appropriate routine, and returns results to the caller.
The event handler parses the language statement to extract the procedure call and the appropriate parameters. It processes the appropriate routine and returns results to the caller. This allows access from any type of database client that can send user-defined SQL statements, such as the isql utility.
To execute the PROCSRV procedures by using language statements, the database client must be directly connected to the PROCSRV application server.