Overview  Dynamic link library support

Chapter 17: Using Extended Stored Procedures

XP Server

Extended stored procedures are implemented by an Open Server application called XP Server, which runs on the same machine as Adaptive Server. Adaptive Server and XP Server communicate through remote procedure calls (RPCs). Running ESPs in a separate process protects Adaptive Server from a failure resulting from faulty ESP code. The advantage of using ESPs instead of RPCs is that the ESP runs in Adaptive Server the same way a stored procedure runs; you do not need to have Open Server to run the ESP.

XP Server is automatically installed when Adaptive Server is installed. However, if you intend to develop XP Server libraries, you must purchase an Open Server license. Everything you need to run XP Server’s dlls and commands is included with your Adaptive Server license.

XP Server must be running for Adaptive Server to execute an ESP. Adaptive Server starts XP Server the first time an ESP is invoked and shuts down XP Server when Adaptive Server exits.

On Windows, if the start mail session configuration parameter is set to 1, XP Server automatically starts when Adaptive Server starts.

Using CIS RPC mechanism

You can execute XP Server procedures using a CIS RPC mechanism, in addition to routing through the site handler. To set the two options needed, cis rpc handling and negotiated logins, enter:

//to set 'cis rpc handling'//
sp_configure 'cis rpc handling', 1
//or at the session level//
set 'cis rpc handling' on
//to set 'negotiated logins'//
sp_serveroption XPServername, 'negotiated logins', true

If either option is not set, for example if cis rpc handling is on, but negotiated logins is not true, the ESP is routed through the site handler. and no warning message appears.

Using sybesp_dll_version()

Sybase recommends that all libraries loaded into XP Server implement the function sybesp_dll_version(). The function returns the Open Server API version used by the DLL. Enter:

CS_INT sybesp_dll_version()
----------
CS_CURRENT_VERSION

CS_CURRENT_VERSION is a macro defined in the Open Server API. The DLL can use it, instead of hardcoding a specific value. If this function is not implemented, XP Server does not attempt to perform version matching. It prints error message #11554 in the log file. (For information on message, see the Troubleshooting and Error Messages Guide.) However, XP Server continues loading the DLL.

If there is a mismatch in versions, XP Server prints error message 11555 in the log file, but continues loading the DLL.

Starting XP Server manually

Normally, there is no reason for a user to start XP Server manually, since Adaptive Server starts it when it receives the first ESP request of the session. However, if you are creating and debugging your own ESPs, you may find it necessary to start XP Server manually from the command line using the xpserver utility. See the Utility Guide for your platform for the syntax of xpserver.





Copyright © 2005. Sybase Inc. All rights reserved. Dynamic link library support

View this book as PDF