Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 Getting unmapped SQL error code 10038 when connecting to MS SQL.


Why am I getting the error "Unmapped SQL error code 0038 - Attempt to initiate new SQL server operation with results pending"?   

    One reason we have found for this error is an incomplete connection to the server via a VPN and/or proxy server. We have Debugged the BDE code up to the point of a dialup connection to a server failing with the 0038 error. It failed during the single MS DBLIB function call to connect to the server. There aren't any changes that can be made or options that can be set that will "fix" this. It seems to do with how a MS DBLIB connection behaves across a firewall and/or VPN. Each subsequent action against the server (executing an sql statement of any kind) resulted in the "...results pending error".

    You might find that other tools don't do this. MS's Windows ISQL is a good example. The main difference there is that it will try to reconnect when the initial connection appears to been dropped or failed to succeed. The BDE does not do this because many of its operations rely on a persistent connection to carry out supported features."

    There is now a way to work around this. There is a new TDatabase param called "CANCEL QUERY". It can be set to either "dbcancel" or "dbcanquery". In addition to params like:

    USER NAME=varick PASSWORD=mypass

    a TDatabase's params list can include

    CANCEL QUERY=dbcanquery

    "dbcancel" is the default. "dbcanquery" was added to take care of those situations where the MSSQL server is unable to process a "dbcancel" of pending results which may be the case when getting this error.

    But before this property can be used in a TDatabase the parameter must be added for the MSSQL driver. This can be done by adding the following registry entry to the DB OPEN section of the MSSQL driver (using REGEDIT.EXE):

    HKEY_LOCAL_MACHINE\SOFTWARE\Borland\Database Engine\Settings\DRIVERS\MSSQL\DB OPEN

    Name: CANCEL QUERY Data: ""

    Without the registry change the CANCEL QUERY param in the TDatabase has no affect (always dbcancel). Once the registry entry had been made to the MSSQL driver the CANCEL QUERY param could be used to control the cancel mode (dbcancel or dbcanquery).

    Another possible workaround might be to use ODBC instead as it does not use DBLIB.

     



  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use