ASP/COM+ solutions using Visual FoxPro ODBC driver may fail under stress (288863)



The information in this article applies to:

  • Microsoft Visual Studio, Enterprise Edition 6.0
  • Microsoft Visual Studio 6.0 SP4
  • Microsoft ODBC Driver for Visual FoxPro (Build 6.00.8281.00) 6.0
  • Microsoft Active Server Pages
  • ActiveX Data Objects (ADO) 1.0
  • ActiveX Data Objects (ADO) 1.5
  • ActiveX Data Objects (ADO) 2.0
  • ActiveX Data Objects (ADO) 2.01
  • ActiveX Data Objects (ADO) 2.1
  • ActiveX Data Objects (ADO) 2.1 SP1
  • ActiveX Data Objects (ADO) 2.1 SP2
  • ActiveX Data Objects (ADO) 2.5
  • ActiveX Data Objects (ADO) 2.6

This article was previously published under Q288863

SYMPTOMS

When designing a solution that uses the Visual FoxPro ODBC (VFPODBC) driver, developers may find that their COM objects fail (hang or crash) when the solution is under heavy load. This occurs regardless of the version of the VFPODBC driver.

CAUSE

COM objects that are developed with Microsoft Visual Basic, Microsoft Visual C++, or other development languages are widely used as middle-tier business objects in large-scale, multiuser solutions. These COM objects are often resident in MTS/COM+ packages, and use the VFPODBC driver to query and update data from Microsoft Visual FoxPro and Microsoft FoxPro 2.x tables.

The problem with this design is that the Visual FoxPro ODBC driver is not thread-safe, and as a result, MTS/COM+ (or the objects themselves if they are stand-alone) can fail.

Note The Drvvfp.hlp and Vfpodbc.txt files that are installed with the driver both state that the VFPODBC driver is thread-safe; this is incorrect.

WORKAROUND

To work around this problem, you can do one of the following:
  • Use a multithreaded COM DLL (MTDLL) built with Microsoft Visual FoxPro 6.0 Service Pack 3 or later. VFP 6.0 SP3 MTDLLs can manipulate FoxPro data using the native FoxPro language and are thread-safe.
  • Move the FoxPro data from the FoxPro tables to another data source (such as SQL Server). Utilize a thread-safe ODBC driver or OLE DB provider for that alternate data source from the problematic COM object.
  • Use the Microsoft OLE DB Provider for Visual FoxPro. The Visual FoxPro OLE DB Provider is thread-safe and may be used without causing failures. Currently, the Visual FoxPro OLE DB Provider is included with Visual FoxPro 7.0 and later versions. The Visual FoxPro OLE DB Provider is also available free for download from Microsoft. For more information, visit the following Microsoft Developer Network (MSDN) Web site:

MORE INFORMATION

If the solution using the VFPODBC driver is not under heavy usage, this problem can potentially be resolved by doing the following:
  1. Make sure that the programmatic connection string or ODBC data source name (DSN) that uses the VFPODBC driver does not have the Fetch Data In Background option selected. The BackgroundFetch attribute keyword in connection strings should equal NO, or the Fetch Data In Background option should not be selected when setting up a DSN in ODBC Data Source Administrator.
  2. Ensure the validity of the TMP and TEMP system environmental variables on the computer that hosts the VFPODBC driver. The VFPODBC driver creates temporary files as it works, and it uses these environmental variables to determine where to write the files. If these variables are not present, problems with nonexistent directories or drives with insufficient free safe can occur.

REFERENCES

For additional information about how to use the Microsoft Visual FoxPro ODBC driver together with MTS/COM+, click the following article numbers to view the articles in the Microsoft Knowledge Base:

269881 Problems with Visual FoxPro driver "Fetch Data In Background" option

236019 ASP application using ADO with Visual FoxPro ODBC driver crashing IIS

270106 VFP ODBC driver in COM DLL under MTS package may hang

(c) Microsoft Corporation 2001, All Rights Reserved. Contributions by Trevor Hancock, Microsoft Corporation.

Modification Type:MinorLast Reviewed:8/15/2005
Keywords:kbAutomation kbDatabase kbInprocSvr kbLocalSvr kbprb KB288863