PRB: Checking Version of Driver Manager from an Application |
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 preceding 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
} The following file is available for download from the Microsoft
Download Center. Click the file name below to download the file:
Getver.exeFor additional information about how to download Microsoft Support files, click the article number below to view the article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online ServicesMicrosoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed on secure servers that prevent any unauthorized changes to the file.
Additional query words: Getver 1.50 C++ Excel Word Desktop Database DM Access VB Basic MSVC 2.00
Keywords : kbfile kbODBC kbGrpVCDB kbDSupport
Issue type : kbprb kbinfo
Technology :
|
Last Reviewed: November 10, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |