Client-initiated Events

Most Open Data Services events are initiated by SQL Server client applications. The client applications use the same set of DB-Library functions to communicate with SQL Server database servers and with Open Data Services server applications.

Each Open Data Services event initiated by a client application has a corresponding DB-Library function. The following table shows the DB-Library client requests that activate Open Data Services events:

DB-Library
call
Open Data Services
event activated

Description of event
dbcancel SRV_ATTENTION Interrupt request
dbclose SRV_DISCONNECT Disconnect request
dbopen SRV_CONNECT Connect request
dbsqlexec SRV_LANGUAGE Language request
dbrpcsend SRV_RPC Remote stored procedure request

In addition, Open Data Services provides a built-in remote stored procedure, sp_sqlexec, that allows a server or a client to send a language request that is formatted for a non – SQL Server data source to the Open Data Services server application in the form of a remote stored procedure argument. When an sp_sqlexec request is received by Open Data Services, Open Data Services converts the sp_sqlexec string into a language request, allowing the server application's language event handler to pass the request to an alternate data source.

Remote
stored
procedure
call



Event activated



Description of event
sp_sqlexec SRV_LANGUAGE Uses a remote procedure call to pass a string containing a language request to the language event handler, which then interprets the string as a language request.

For DB-Library client applications that run on Windows or Windows NT, if the client computer's AutoAnsiToOem setting is enabled, the client application will generate an SRV_LANGUAGE event immediately following the SRV_CONNECT event to determine which character set the server is using.

Open Data Services server applications should include code to handle this event without generating an error. The query calls the catalog stored procedure sp_server_info with a parameter of 18 to obtain the server's COLLATION_SEQ value. If the first 5 bytes of the resulting value is iso_1, it indicates that the server is returning string data in the ANSI code page, and DB-Library does not need to perform any character set conversions. If the resulting value is anything else, DB-Library assumes that the server is returning string data in an OEM code page (such as 437 or 850). In this case, DB-Library performs a character set conversion to convert all string data into the Windows ANSI code page, unless conversion is explicitly turned off in the client application. For more information about character set conversions in DB-Library, see the Microsoft SQL Server Programming DB-Library for C. For more information about catalog stored procedures, see the Microsoft SQL Server Transact-SQL Reference.

Alternatively, for any DB-Library clients that connect only to Open Data Services, you can disable this event by turning off the client computer's AutoAnswerToOem setting. This setting can be changed using the SQL Client Configuration Utility.