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

15,199

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.

Share:
15,199
BIBD
Author by

BIBD

Oh gawd, I never fill these out

Updated on June 05, 2022

Comments

  • BIBD
    BIBD almost 2 years

    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
    
  • tcarvin
    tcarvin over 10 years
    Why would it matter where the VB6 executable is? Is it your "old VB6 app" that needs to be in a path without a parenthesis? Or was it the VB6 debugger that could not connect?
  • BIBD
    BIBD over 10 years
    Logically, it shouldn't. I imagine it must be the debugger, and only when it's opening the Oracle connection. My project is still in the same physical location. The only thing I did was re-install VB6 in parenthesis free path. Maybe it's something to do with the MsOrcl32.dll - do these things get copied into the VB6 directory when you are debugging?