SQL asynchronous queries

<< Click to Display Table of Contents >>

Navigation:  Application development > Database driver characteristics > SQL drivers >

SQL asynchronous queries

Previous pageReturn to chapter overviewNext page

SQL Links can cancel long-running queries if the server supports asynchronous query submission. Verify that your SQL Link driver currently supports asynchronous query execution on Windows.

Use the dbASYNCSUPPORT database property with DbiGetProp to inquire whether a driver supports asynchronous queries:

dbASYNCSUPPORT                , ro BOOL                Does the driver support

                               asynchronous query execution?

There are two options to asynchronous query submission/cancel:

1.The query cancels because it exceeds the maximum time allowed.

2.The query completes normally.

The parameter MAX QUERY TIME in the BDE configuration file (IDAPI.CFG) is a DB OPEN parameter. It is available for SQL Links drivers that support this feature, such as those for Sybase and Microsoft SQL Server.

Note:By default, SQL statements sent to MS SQL and Sybase servers using DB-Lib are now sent using the synchronous query submission API. Earlier versions of SQL Links used the asynchronous query submission API. To use the asynchronous query submission API, add 2048 to the current value of DRIVER FLAGS or set it to 2048 if it's blank.

You can use the BDE Administrator to set MAX QUERY TIME for the maximum amount of time (seconds) you want to wait for a query to finish executing. (The default value is 3600 seconds, or one hour.)  If this time limit is exceeded, the query is canceled. When a query is successfully canceled, DBIERR_CANCEXCEPT "Query canceled" is returned.

 

hmtoggle_plus1SQL driver topics