Connection Object (Net-Library)
Represents a connection from a Windows application to an instance of the SQL Server database engine.
Remarks
This object contains whatever information is necessary to setup and maintain a connection with a given instance of SQL Server. Its contents will be IPC-dependent. Before you can open and use an instance of this object, you must do the following:
- Call the ** ConnectionObjectSize routine to get the necessary size.
- Allocate a block of memory of that size and keep a pointer to it.
- Pass that pointer to all subsequent Net-Library API routines.
- Free the allocated memory after the ConnectionClose call*.*
Net-Library API provides access to an instance of the SQL Server database engine through ConnectionOpen, which takes a server name as a parameter. The ConnectionOpen routine is then responsible for finding and connecting to the desired server instance, in whatever way is necessary.
On many systems, connection-specific information will be stored in the Windows Registry. When you implement the Net-Library API, however, you are not restricted to a registry-only approach. You might choose to implement server connectivity in a different way. The Net-Library API frees a client application from knowing anything other than the name of the server it wants to communicate with.
For more information about registry entries that can be used with the Net-Library API, see Appendix A: Registry Entries.
Type definitions
The following type definitions are used throughout the Net-Library API:
typedef unsigned char BOOL /* unsigned 1 byte */
typedef unsigned char BYTE /* unsigned 1 byte */
typedef unsigned short USHORT /* unsigned 2 bytes */
typedef short SHORT /* signed 2 bytes */
typedef long LONG /* signed 4 bytes */
typedef int RETCODE /* SUCCEED or FAIL */