我正在尝试使用VB脚本连接到Oracle DB。我还在管理工具上添加了Microsoft ODBC for Oracle。我仍然得到错误 运行时错误' -2147467259(80004005)': [Microsoft] [ODBC驱动程序管理器]未找到数据源名称且未指定默认驱动程序
代码如下:
Sub ora_connection()
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim query As String
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
strCon = "Driver = {Microsoft ODBC for Oracle}; " & _
"CONNECTSTRING=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST= <provided the host as per TNS>)(PORT = 1521))" & _
"(CONNECT_DATA=(SERVICE_NAME=<Provided the service_name as per the TNS>))); uid=<User id >; pwd=<password>;)"
con.Open (strCon)
End Sub