添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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
                This might be helpful (if you have not seen it already): social.msdn.microsoft.com/Forums/sqlserver/en-us/…
– ChristopheD
                Nov 5, 2013 at 23:04
                Yah, I saw that. It seems to be highly focused on file paths for SSIS and a problem Oracle has with parenthesis. It's not looking like a promising path for me.
– BIBD
                Nov 6, 2013 at 17:19

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.

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? – tcarvin Nov 7, 2013 at 12:30 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? – BIBD Nov 7, 2013 at 15:28

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.