sql >> Base de Datos >  >> RDS >> Oracle

Uso de VBS y el registro para determinar qué versión y controladores de Oracle de 32 y 64 bits están instalados

De acuerdo con su código VBS, la pregunta debería ser:Usar VBS y el registro para determinar qué versión y 32 vs. 64 bits de ODBC los controladores están instalados

Hay muchos otros controladores disponibles para Oracle, p. OleDB, ODP.NET, JDBC, etc.

Para conseguir 32 y 64 bits puedes hacerlo de dos formas

Ejecute el VBS en un host de secuencias de comandos diferente, es decir,

For 64 Bit: >c:\Windows\system32\cscript.exe Drivers.vbs
For 32 Bit: >c:\Windows\SysWOW64\cscript.exe Drivers.vbs

O modifique el script VBS para interrogar la ruta de 32 y 64 bits en el Registro:

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) & " -- 64 Bit " & strValue
Next

strKeyPath = "SOFTWARE\Wow6432Node\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) & " -- 32 Bit " & strValue
Next

Otra nota:TNS_ADMIN y ORACLE_HOME puede definirse por variable de entorno, sin embargo, también puede definirlos en el Registro. Buscar 64 bits

HKLM\SOFTWARE\ORACLE\Key_{ORACLE_HOME_NAME}\TNS_ADMIN 
and 
HKLM\SOFTWARE\ORACLE\Key_{ORACLE_HOME_NAME}\ORACLE_HOME

y para 32 bits

HKLM\SOFTWARE\Wow6432Node\ORACLE\Key_{ORACLE_HOME_NAME}\TNS_ADMIN
and
HKLM\SOFTWARE\Wow6432Node\ORACLE\Key_{ORACLE_HOME_NAME}\ORACLE_HOME