Oracle database connection in vba

Copper Contributor

Hello ,

i am trying to connect oracle database but here i am facing issue to choose Driver(provider) which i have to use here .i have selected "microsoft activex data object 2.5 library" .My machine is 64 bit widow 10 with office 2016 . can anyone please suggest which driver i need to install for oracle connection .it will great please provide me the link where to download.i tried to install "ODAC121024_x64" but due to some reason it hang for long time in pree-checks .

 

Thank you in advance.

 

Sub dev_connection()

Dim strConnection As String
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String

Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset

strConnection = "Provider=Microsoft OLE DB Provider for Oracle;Data Source=0.0.0.0:1521:xe;User Id=system;Password=oracle;"

conn.ConnectionString = strConnection
conn.Open

strSQL = "SELECT * FROM dual"
rs.Open strSQL, conn, 3, 3

rs.MoveFirst
While Not rs.EOF
MsgBox rs(1)
rs.MoveNext
Wend
rs.Close
conn.Close
Set conn = Nothing
Set rs = Nothing
End Sub

1 Reply