Article ID: 198520
Article Last Modified on 6/1/2005
APPLIES TO
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft SQL Server 7.0 Standard Edition
- Microsoft SQL Server 2000 Standard Edition
This article was previously published under Q198520
SYMPTOMS
SQL Server 7.0 and SQL Server 2000 provide a mechanism for
performing distributed queries against an OLE DB provider. You can use the new
OpenQuery function or the
OpenRowset function. For example, the following SQL statement performs a
query against an OLE DB provider called MyProv by using the command
Select * from table1:
Select * from OpenRowset('MyProv', '', 'Select * from table1')
If an ATL wizard-generated OLE DB Provider is queried by using the
following command, you receive a Server error message:
select * from openrowset ('MyProv.MyProv', '','c:\*.*')
The error message is:
Server: Msg 7399, Level
16, State 1, Line 1 OLE DB Provider 'atlprov' reported an error. The provider
ran out of memory
CAUSE
This behavior occurs because of the following problems in
the Atldb.h header file:
- The ATL IRowsetImpl::GetColumnInfo method fails to return information correctly.
- The IRowsetImpl::GetData method does not handle provider-owned memory
correctly.
RESOLUTION
The Atldbfix.h file, provided below, is a revised copy of
the Atldb.h file that is included with Visual Studio Service Pack 5. Search the
Atldbfix.h header file for "Fix:" to find where the changes have been made.
Instead of including the Atldb.h header file in your project,
replace it with the Atldbfix.h file, after which you will encounter the
following error message:
Server: Msg 7347, Level 16,
State 1, Line 1 OLE DB Provider 'Atlprov' returned an unexpected data length
for the fixed-length column '[].FileName'. The expected data length is 260,
while the returned data length is 12.
This error is caused by a bug
in the ATL wizard-generated code, which returns a fixed-length string when it
should be returning a variable length string of type DBTYPE_STR.
In
the ATL wizard-generated sample provider, change the following two lines in the
provider column map from the following:
PROVIDER_COLUMN_ENTRY("FileName", 4, cFileName)
PROVIDER_COLUMN_ENTRY("AltFileName", 5, cAlternateFileName)
to the following:
PROVIDER_COLUMN_ENTRY_STR("FileName", 4, cFileName)
PROVIDER_COLUMN_ENTRY_STR("AltFileName", 5, cAlternateFileName)
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
REFERENCES
For more information and to download a Support WebCast,
visit the following Microsoft Web site:
Additional query words: atldbfix
Keywords: kberrmsg kbdownload kbtshoot kbbug kbsqlprog kbconsumer kbpatch kbdatabase kbfile kbmdacnosweep kbpending KB198520