0
問候..VBA到Oracle 10g錯誤
我對Oracle很陌生,但在Sql中有知識。
我試圖外部Oracle DB從VBA連接 - Excel的下面是代碼..
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_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=207.169.236.29)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=DEDWRP01.DE.EDS.COM))); uid=" & strUser & " ;pwd=" & strPassword & ";"
Set oConOracle = CreateObject("ADODB.Connection")
Set oRsOracle = CreateObject("ADODB.Recordset")
oConOracle.Open strConOracle
End Function
試圖運行上面的代碼我得到下面的錯誤..
[Microsoft] [用於Oracle的ODBC驅動程序] [Oracle] ORA-12154:TNS:Cound未解析指定的連接標識
我已經安裝了oracle 10g,並且我能夠通過連接數據庫在SQL * Plus ..
請幫我.Thanks對於提前幫助..
您是否嘗試明確設置tnsnames條目,並創建一個DSN和teste從ODBC管理面板中查看它?我會首先嚐試排除ODBC安裝問題。 – OldProgrammer
感謝您的評論...請讓我知道我該怎麼做?新的。:(請 –
請檢查http://www.connectionstrings.com/oracle/。在此頁面中查找「Microsoft ODBC」以獲取不同的連接方式,具體取決於您想要的方法。 – shahkalpesh