Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Visual FoxPro makes it possible for you to share a connection handle for a remote data connection. Sharing a connection handle can be desirable when you want to manage SQL Server connections and server resources better by reducing the number of connections.
By default, Visual FoxPro creates a new connection handle each time a remote data connection is created. However, when specified, Visual FoxPro can use an existing connection and associate the new statement with it. This creates a new statement handle and Visual FoxPro handle; however, the associated connection handle is the same.
There are three types of handles associated with a remote data connection. The following table describes these handles.
Handle type |
Description |
|---|---|
Connection handle (ODBC HDBC) |
A unique integer assigned to a connection. |
Statement handle (ODBC HSTMP) |
A unique integer assigned to a statement. Note More than one HSTMP statement handle can be associated with a HDBC connection handle. |
Visual FoxPro connection handle |
A unique integer assigned by Visual FoxPro to a unique statement handle. |
Shared Connections for Remote Views
A remote view can use a shared connection handle by including the SHARE keyword in the CREATE SQL VIEW command. If a shared connection is available, Visual FoxPro uses it to create a new statement handle and Visual FoxPro connection handle. If a shared connection is unavailable, Visual FoxPro creates a new, shared connection that other views can use.
Shared Connections for SQL Pass-Through
You can create a new connection that can be shared by including the lShared parameter in the SQLSTRINGCONNECT( ) command. The SQLSTRINGCONNECT( ) command always creates a new connection, statement, and Visual FoxPro connection handle.
Including the lShared parameter in the SQLCONNECT( ) command also creates a new connection that can be shared; however, including the nStatementHandle parameter causes SQLCONNECT( ) to use a currently shared connection and creates only a new statement handle and Visual FoxPro connection handle.
See Also
Tasks
How to: Share Connections for Multiple Remote Views
Concepts
Managing Connections with SQL Pass-Through