Error connecting ODBC to Oracle server.

Asked 2 years ago, Updated 2 years ago, 98 views

This is my first question.
Error code 3076 アプリケーションApplication Definition or Object Definition Error 」 when connecting to Oracle server using EXCELVBA.
I tried several ways to resolve the error, but it didn't work.
I recently started studying EXCELVBA due to my work, but there was no one around me who was familiar with it, so I asked you a question.

databases:oracle11g
Excel: Microsoft Excel 2010

(Workaround)
Change reference settings: Checked Microsoft ActiveX Data Objects 2.X Library.
I installed ORACLE PROVIDER FOROLE DB in the installer.

That's all.If you know how to deal with it, please give me some advice.

Subtest()
 Dimcn As Object
 Dim cont As String
 Set cn=CreateObject("ADODB.Connection")
 contStr="Provider=OraOLEDB; Data Source=Server Name; User ID=User Name; Password=Password"
cn.OpenconStr
 End Sub

excel vba oracle

2022-09-30 16:51

1 Answers

When I tried the Excel 2010+Oracle 11g Client environment at hand, I got the same error, but after fixing the following parts, it worked.
Why don't you give it a try?
参照We have not changed the reference settings.

contStr="Provider=OraOLEDB;...

contStr="Provider=OraOLEDB.Oracle;...

Subtest()
    Dimcn As Object
    Dim cont As String
    Dims As Object

    Set cn=CreateObject("ADODB.Connection")
    contr="Provider=OraOLEDB.Oracle;Data Source=TNS Net Service Name;User ID=Username;Password=Password"
    cn.OpenconStr

    Sets = CreateObject("ADODB.Recordset")' Record Set
    rs.Open "select* from USER_TABLES where runnum<=3", cn
    Do Untilers.EOF
        MsgBoxrs("TABLE_NAME").Value
        rs.MoveNext
    Loop
    rs.Close
    cn. Close
End Sub


2022-09-30 16:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.