Akhirnya mengedit/menggunakan fungsi ini (yang tidak(?) menggunakan driver/penyedia:InstantClient tetapi masih menggunakan file):
Function ORAQUERY(strHost As String, strDatabase As String, strSQL As String, strUser As String, strPassword As String)
Dim strConOracle, oConOracle, oRsOracle
Dim StrResult As String
StrResult = ""
strConOracle = "Driver={Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=" & strHost & ")(PORT=1521))" & _
"(CONNECT_DATA=(SERVICE_NAME=" & strDatabase & "))); uid=" & strUser & " ;pwd=" & strPassword & ";"
Set oConOracle = CreateObject("ADODB.Connection")
Set oRsOracle = CreateObject("ADODB.Recordset")
oConOracle.Open strConOracle
Set oRsOracle = oConOracle.Execute(strSQL)
MsgBox (oRsOracle.Fields(0).Value)
varResult = oRsOracle.GetRows
Do While Not oRsOracle.EOF
If StrResult <> "" Then
StrResult = StrResult & Chr(10) & oRsOracle.Fields(0).Value
Else
StrResult = oRsOracle.Fields(0).Value
End If
oRsOracle.MoveNext
Loop
oConOracle.Close
Set oRsOracle = Nothing
Set oConOracle = Nothing
ORAQUERY = StrResult
End Function
String Koneksi lengkap yang benar:
Driver={Microsoft ODBC for Oracle}; CONNECTSTRING=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=strHost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=strDatabase))); uid=strUser; pwd=strPassword;
Penyedia atau Driver:
{Microsoft ODBC for Oracle}
Diperlukan untuk menyetel variabel lingkungan PATH untuk menunjuk ke klien instan.
Tidak menggunakan variabel lingkungan lain, mis. ORACLE_HOME, TNS_ADMIN, dll.