Monday, February 16, 2015

List 64 bit and 32 bit ODBC drivers

It is sometimes a bit confusing to find out which ODBC drivers are installed (especially when we need to know precisely which drivers are 32bit or 64bit). This script when run from a 64 bit GAMS version will list all 32 bit and 64 bit drivers:

$ontext 

  Run from 64 bit GAMS

$offtext

$onecho > listodbc.vbs
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers"
objRegistry.EnumValues HKEY_LOCAL_MACHINE, strKeyPath, arrValueNames, arrValueTypes

For i = 0 to UBound(arrValueNames)
   strValueName = arrValueNames(i)
   objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
   Wscript.Echo arrValueNames(i) & " -- " & strValue
Next
$offecho


$call echo ===== 64 bit ODBC drivers =======
$call cscript listodbc.vbs //Nologo
$call echo ===== 32 bit ODBC drivers =======
$call \windows\syswow64\cscript listodbc.vbs //Nologo

The output looks like:

===== 64 bit ODBC drivers =======
SQL Server -- Installed
SQL Server Native Client 11.0 -- Installed
ODBC Driver 11 for SQL Server -- Installed
===== 32 bit ODBC drivers =======
Microsoft Access-Treiber (*.mdb) -- Installed
Driver do Microsoft Paradox (*.db ) -- Installed
Driver do Microsoft Excel(*.xls) -- Installed
Microsoft Text Driver (*.txt; *.csv) -- Installed
Driver da Microsoft para arquivos texto (*.txt; *.csv) -- Installed
Microsoft dBase-Treiber (*.dbf) -- Installed
SQL Server -- Installed
Microsoft Excel Driver (*.xls) -- Installed
Driver do Microsoft dBase (*.dbf) -- Installed
Microsoft Paradox-Treiber (*.db ) -- Installed
Microsoft ODBC for Oracle -- Installed
Microsoft Text-Treiber (*.txt; *.csv) -- Installed
Microsoft Excel-Treiber (*.xls) -- Installed
Microsoft Access Driver (*.mdb) -- Installed
Driver do Microsoft Access (*.mdb) -- Installed
Microsoft Paradox Driver (*.db ) -- Installed
Microsoft dBase Driver (*.dbf) -- Installed
SQL Server Native Client 11.0 -- Installed
ODBC Driver 11 for SQL Server -- Installed
SQLite3 ODBC Driver -- Installed

See also: http://blogs.technet.com/b/heyscriptingguy/archive/2005/07/07/how-can-i-get-a-list-of-the-odbc-drivers-that-are-installed-on-a-computer.aspx.

No comments:

Post a Comment