---
title: Obtaining the Version of the Mertech Driver in Use
description: How to find out if you have the correct version Btr2SQL installed
---

[Mertech Blog ](https://www.mertech.com/blog)

# [Obtaining the Version of the Mertech Driver in Use](https://www.mertech.com/blog/obtaining-the-version-of-the-mertech-driver-in-use)

 Written by [Thomas Oatman](https://www.mertech.com/blog/author/thomas-oatman) | Nov 9, 2009 5:45:00 PM

When an application has been ported from Btrieve to a SQL backend and the Btrieve access dll (w3btrv7 or wbtrv32) has been replaced, the application does not have any indication the backend has changed. Perhaps you would like the application to verify which backend is in use or you want to be sure the correct version of the Mertech driver is installed. This can be done through a standard BTRV function call using B_EXTENDED_VERSION (5026) defined in mds_btrieve.h provided with our driver SDK.

B_EXTENDED_VERSION is fully documented in the SDK docs but we’ll give an overview here and some sample code.  Two main sub-functions are provided – the Mertech driver version and the SQL server version.  
 

```
BTI_ULONG dataLen;BTI_SINT stat;
```

B_VERSION_T verData[3]; memset(&verData[0], 0, sizeof(verData));

stat = BTRCALL(B_VERSION, NULL, &verData, &(dataLen=sizeof(verData)), NULL, 0, 0);  
 if (stat == B_NO_ERROR)  
 printBVersion(verData, dataLen);  
 else  
 cerr << "Error loading Btrieve dll" << endl;

MDS_VERSIONINFO mdsVersionInfo;  
 stat = BTRCALL(B_EXTENDED_VERSION, NULL, &mdsVersionInfo, &(dataLen=sizeof(mdsVersionInfo)), NULL, 0, MDS_VERSION_OF_DRIVER);  
 if (stat == B_NO_ERROR)  
 cout << "Mertech driver version for " << mdsVersionInfo.originalDllName << ": " << mdsVersionInfo.versionString << endl;  
 else  
 cerr << "Status " << stat << " returned from B_EXTENDED_VERSION" << endl;

MDS_SQL_LOGIN loginInfo = {"", "", "", "", ""};  
 stat = BTRCALL(B_SQL_LOGIN, NULL, &loginInfo, &(dataLen=sizeof(loginInfo)), NULL, 0, 0);  
 if (stat == B_NO_ERROR)  
 {  
 char sqlVersionString[2000];  
 stat = BTRCALL(B_EXTENDED_VERSION, NULL, &sqlVersionString, &(dataLen=sizeof(sqlVersionString)), NULL, 0, MDS_VERSION_OF_SERVER);  
 if (stat == B_NO_ERROR)  
 cout << "Server version: " << sqlVersionString << endl;  
 else  
 cerr << "Status " << stat << " returned from B_EXTENDED_VERSION" << endl;  
 }

 

[View full post](https://www.mertech.com/blog/obtaining-the-version-of-the-mertech-driver-in-use)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Thomas Oatman"
  },
  "dateModified" : "2024-05-29T22:02:54.853Z",
  "datePublished" : "2009-11-09T17:45:00Z",
  "headline" : "Obtaining the Version of the Mertech Driver in Use",
  "image" : {
    "@type" : "ImageObject",
    "height" : 253,
    "url" : "https://info.mertech.com/hubfs/Group%20769.png",
    "width" : 472
  },
  "mainEntityOfPage" : "https://www.mertech.com/blog/obtaining-the-version-of-the-mertech-driver-in-use",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "Blog"
  }
}
```