PRB: Checking Version of Driver Manager from an ApplicationID: Q115881
|
An ODBC version 2.0 application needs to have a version 2.0 ODBC driver
manager (Odbc.dll). One way to verify the version of the driver manager is
to make a call to SQLGetInfo with fInfoType= SQL_ODBC_VER. An application
must connect to a specific driver before calling SQLGetInfo because that
function requires a valid connected hdbc (connection handle).
Note, for certain post-1.0 and pre-2.0 versions of Odbc.dll (actual file
version 1.5.xxxx), the return value for the SQLGetInfo call with
InfoType=SQL_ODBC_VER, is "02.00.0000" or "02.00".
For example, the driver manager Odbc.dll that shipped with Microsoft Word
version 6.0 for Windows returns "02.00" for the above call. Similarly, the
driver manager Odbc.dll that shipped with Microsoft Visual C version 1.5
for Windows, returns the version as "02.00.0000". Therefore, a 2.0 ODBC
application which uses SQLGetInfo to confirm it is using a true 2.0 driver
manager may fail against one of these earlier versions.
In order to correctly distinguish a true 2.0 driver manager from one
returning an incorrect version (referenced above), a version 2.0
application should incorporate one of the following checks to ensure that
an incorrect version of driver manager is not loaded:
char buf[2];
HMODULE hmodule;
hmodule = GetModuleHandle ("odbc.dll");
if (LoadString (hmodule, 199, buf, sizeof(buf)))
{
if ((*buf | 0x20) >= 'g')
{
// Release 2.0 DM or later
}
else
{
// Older Driver Manager
}
}
else
{
// Older Driver Manager
}
Getver.exe is a sample program that uses the version functions in Microsoft
Windows version 3.1 Software Development Kit (SDK) to get the file version
of ODBC driver manager (ODBC.DLL).
You can find GETVER.EXE, a self-extracting file, on the following services:
Q119591 How to Obtain Microsoft Support Files from Online Services
Additional query words: 1.50 C++ Excel Word Desktop Database DM Access VB Basic MSVC
Keywords : kbfile
Version : WINDOWS:1.5,2.0
Platform : WINDOWS
Issue type :
Last Reviewed: July 9, 1999