How can I get the "Microsoft ODBC for Oracle" driver to work in Windows 7 - oracle

I have an old VB6 app that I need to get working on a Windows 7 x64 workstation (at least for a little while).
It's failing on me when I try to connect to my test database (Oracle 10gR2). I get an "ORA-06413: Connection not open error."
Now, I recognise that the "Microsoft ODBC for Oracle" driver is deprecated because it doesn't play nice with newer versions of Oracle. It seems to work fine with the same database on an XP box I have access to.
I also see that the driver seems to still exist on Windows 7 x64 (at least when I look at the 32 bit version of the ODBC data Source Administrator tool: c:\Windows\SysWOW64\odbcad32.exe in the Drivers tab.
On the XP box, it doesn't seem to matter what I see up for an ODBC connection, it seems to bypass any sort of predefined connection.
Attached is the relevant code. Is there any way to make this work in Win7x64?
Global g_sConnectionString As String
Global g_oConn As ADODB.Connection
Public Sub CreateOracleConn()
Err.Clear
On Error Goto ConnectionError
g_sConnectionString = "Driver={Microsoft ODBC for Oracle}; " _
& "SERVER=" & "MyHost" _
& ";UID=" & "MyUserID" _
& ";PWD=" & "MyPassword & ";"
Set g_oConn = New ADODB.Connection
g_oConn.Open g_sConnectionString '<-- fails here
Exit Sub
ConnectionError:
If Err.Number <> 0 Then
'Clean up from the error
End If
End Sub

The problem entirely relates to where Visual Basic 6 is installed. By default it is installed in C:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.EXE
If you change its location to something like:
C:\ProgramFilesX86\Microsoft Visual Studio\VB98\VB6.EXE
It runs properly.

Related

Calling VBS CreateObject("someapp.someapp", "remote PC") for a COM interface on another machine?

Disclaimer: Yes, I think this questions boils down to understanding some DCOM basics and what VBS CreateObject actually does/needs:
I have a 3rd party application that offers an automation interface via (D?)COM.
The interface is automatically registered when we install the application and it works fine when running simple VBS scripts locally:
This works fine on the same machine:
Dim oAppApi
WScript.Echo "Hello, try to connect ..."
Set oAppApi = CreateObject("theapp.theapp") ' Note that this will either start the application or connect to an already started instance
WScript.Echo oAppApi.APIVersion
oAppApi.DisconnectFromTool
This also works on the same machine:
Dim oAppApi
WScript.Echo "Hello, try to connect ..."
Set oAppApi = CreateObject("theapp.theapp", "localhost")
WScript.Echo oAppApi.APIVersion
oAppApi.DisconnectFromTool
This will fail when run on another PC in the same network:
Dim oAppApi
WScript.Echo "Hello, try to connect ..."
Set oAppApi = CreateObject("theapp.theapp", "machineNameWithAppInstalled") ' FAIL: ActiveX component can't create object
What would be neccessary to make this simple VBScript work from the remote machine?
Would anything need to be installed on the client machine? (COM proxy DLL or somesuch?)
Does the ServerName.TypeNameof CreateObject need to be known on the client side?
Do we have to do some DMCOMCnfg magic on the server?
Additional Details:
Since, from what I know of COM, this might depend on how the stuff is registered, here's my "trace" through the registry for "TheApp.TheApp" on the application PC:
[HKEY_CLASSES_ROOT\TheApp.TheApp]
#="com.company.toolAPI.theapp.theapp"
[HKEY_CLASSES_ROOT\TheApp.TheApp\CLSID]
#="{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}"
[HKEY_CLASSES_ROOT\TheApp.TheApp\CurVer]
#="TheApp.TheApp.7.2"
...
[HKEY_CLASSES_ROOT\TheApp.TheApp.7.2]
#="TheApp.TheApp"
[HKEY_CLASSES_ROOT\TheApp.TheApp.7.2\CLSID]
#="{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}"
...
[HKEY_CLASSES_ROOT\AppID\{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}]
#="THEAPP72 Server"
"DllSurrogate"=""
"RunAs"="Interactive User"
...
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}]
#="com.company.toolAPI.theapp.theapp"
"AppID"="{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}\Implemented Categories]
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}]
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}\InprocServer32]
#="mscoree.dll"
"ThreadingModel"="Both"
"Class"="com.company.toolAPI.theapp.theapp"
"Assembly"="TheAppCOM, Version=11.0.0.0, Culture=neutral, PublicKeyToken=c9b6e760b808c9f9"
"RuntimeVersion"="v2.0.50727"
"CodeBase"="file:///C:/Company/THEAPP7.2/interface/TheAppCOM.DLL"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}\InprocServer32\11.0.0.0]
"Class"="com.company.toolAPI.theapp.theapp"
"Assembly"="TheAppCOM, Version=11.0.0.0, Culture=neutral, PublicKeyToken=c9b6e760b808c9f9"
"RuntimeVersion"="v2.0.50727"
"CodeBase"="file:///C:/Company/THEAPP7.2/interface/TheAppCOM.DLL"
[HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{0CBEA087-0CC7-4D15-A659-8B3AC68B82E1}\ProgId]
#="TheApp.TheApp"
I used RDS.DataSpace to access a 'middle-tier' dcom server.
Example: http://www.oblique.ch/ms/rds25.html#_Toc483670219

MSXML load url failes only on Windows 2016 server

I am trying to modify an old VB6 application so that it can be used on Windows server 2016. At the moment it works well on Windows XP and Windows 7/10.
But for WIndows Server 2016 I do not get it going. I want to grab temperature data via https://xml.buienradar.nl. In the vb6 project I make a reference to msxml6 which I installed on the Windows 2016 server.
At xmldoc.Load ("https: \ xml.buienradar.nl") I get the error: The download of the specified resource has failed.
Firewall is disabled. Does anyone have any idea? I do not have the idea that it goes wrong with the msxml6.dll. Why does this work with all other operating systems?
Set xmldoc = New DOMDocument60
xmldoc.async = False
If xmldoc.Load("https:\\xml.buienradar.nl") = False Then
LogPrint "Load error: " & xmldoc.parseError.url & " - " &
xmldoc.parseError.reason
Else
-- grab data --
End If

VBS: ActiveX component can't create object: 'Citrix.ICAClient' errror on 64-bit

I have a script that looks for all open Citrix connections and disconnects any of them that aren't associated with the user logged in to Windows (Citrix Web Interface connections). It works perfectly fine on 32-bit machines (XP or 7) but not on 64-bit. I know it does rely on two Citrix reg keys (AllowLiveMonitoring & AllowSimulationAPI) and the WfIcaLib.dll, which will be in different locations on different architecture. I thought it was something with my script and 64-bit, but when I uninstall the Receiver from a 32-bit machine, I get the same exact error. And when I reinstall, the error goes away. No special install switches or method, just a regular install of the 3.4.300 Receiver. So although it must be 64-bit related, it's with Citrix and not just the VBScript code.
Here is my script, the Set icaClient = CreateObject("Citrix.ICAClient") line is where it errors.
Thanks in advance.
Brian
Option Explicit
Dim strWindowsUser
Dim icaClient
Dim sessionHandle
Dim numSessions
Dim sessionID
Dim sessionInfo
Dim ct
Dim wshNetwork
' Get the name of the generic Windows user logged in
Set wshNetwork = WScript.CreateObject("WScript.Network")
strWindowsUser = wshNetwork.UserName
' As the next user is logging into the workstation, look for any
' Citrix sessions not tied to the generic Windows user and disconnect
' the session.
' If you don't want to disconnect, use a Logoff command as follows:
' icaClient.Logoff()
Set icaClient = CreateObject("Citrix.ICAClient")
sessionHandle = icaClient.EnumerateCCMSessions()
numSessions = icaClient.GetEnumNameCount(sessionHandle)x
For ct = 0 To numSessions - 1
sessionID = icaClient.GetEnumNameByIndex(sessionHandle, ct)
icaClient.StartMonitoringCCMSession sessionID, True
'SessionServer = 0,
'SessionUsername = 1
'SessionDomain = 2
sessionInfo = icaClient.GetSessionString(1)
If lcase(sessionInfo) <> lcase(strWindowsUser) Then
icaClient.Disconnect()
End If
icaClient.StopMonitoringCCMSession sessionID
Next
icaClient.CloseEnumHandle sessionHandle
Try manually specifying the 64bit cscript.exe
C:>%windir%\syswow64\cscript.exe script.vbs
I don't have a machine to try this on, but this is what's worked for me in the past.
Edit: Tested your code and it works when hardcoding the 64bit cscript. I'm using Windows 8.1 (x64) and Receiver 4.2 (ICA Client 14.2)
c:\tools>cscript.exe text.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
c:\tools\text.vbs(22, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'Citrix.ICAClient'
c:\tools>%windir%\syswow64\cscript.exe text.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.
c:\tools>

WMI 0x80041013 "Provider load failure"

A number of programs are failing with this error eg, MSinfo32, AS SSD, Samsung Magician etc. I have tried all the following actions to no avail:
Repaired W7 Ultimate SP1 OS using the Upgrade option with a W7 Ultimate SP1 cd.
Run SFC /Scannow - no errors.
Checked that the WMI service is running - ok.
Re-registered all the dll's in c:\windows\system32\wbem.
Re-compiled all the mof and mfl files in c:\windows\system32\wbem.
Ran WMIDiag.vbs. The report highlighted some 40 (WBEM_E_NOT_FOUND) errors - no different to the report from another W7 ultimate machine where WMI works ok.
Registered the system.management.instrumentation.dll with: "regasm %systemdrive%\program files\reference assemblies\microsoft\framework\v3.5\system.management.instrumentation.dll".
Rebuilt the Repository numerous times.
SystemInfo in CMD works fine and returns all system data ok. Msinfo32.exe doesn't.
Interestingly, the following script returns the correct info:
*strComputer = "."
Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_operatingsystem")
For Each objItem In colItems
Wscript.Echo "Name: " & objItem.Name
Next*
but the same query doesn't work in Paessler WMITest.exe - where I get the same 0x80041013 error! So it seems WMI itself is working normally but not when called from, say, MSinfo32.
No WMI error in Event Viewer for startup.
Any ideas of where to go from here?
Andrew

WMI namespace root\cimv2 not available on Win2k?

I'm trying to run the following VBScript code on a Win2k SP4:
strComputer = "."
Set oWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
It works on XP and Win7 without problems, but on this 2k box I get the following error:
C:\test_wmi.vbs(3, 1) (null): 0x8004100E
The error description is: Namespace specified cannot be found.
When I query the namespaces on root, using this code:
strComputer = "."
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & "\root")
Set colNameSpaces = objSwbemServices.InstancesOf("__NAMESPACE")
For Each objNameSpace In colNameSpaces
Wscript.Echo objNameSpace.Name
Next
I get this:
DEFAULT
SECURITY
WMI
directory
aspnet
As far as I have read, CIMV2 namespace should be there. Any ideas???
Thanks!
yorch.
I was on Windows Server 2003, Service Pack 2, and yorch's solution didn't work for me. Finally I found this page, and followed the instructions for Server 2003:
http://www.djordjepejic.com/kb68/index.php/article/winmgmt-could-not-initialize-the-core-parts-solved-even/
For Windows Server 2003
Use the following command to detect and repair a corrupted WMI Repository:
rundll32 wbemupgd, RepairWMISetup
Yes, it should be there. There is a tool called wmidiag.vbs that can help you diagnose WMI problems, but before using it try watching a couple of 'webcasts' that explain how to use it (here and here)
Finally, what worked for me was rebuilding the WMI Repository. This is what I did:
Stop the WMI service (net stop winmgmt)
Go to %windows%/system32/wbem (in my win2k, winnt, on XP would be windows)
Rename or remove the repository directory
Start the WMI service again (net start winmgmt)
Also, this method could have helped (to reinstall WMI into the Registry):
winmgmt /clearadap
winmgmt /kill
winmgmt /unregserver
winmgmt /regserver
winmgmt /resyncperf
Thanks Uros for your help, both webcasts and the tool were very helpful.

Resources