我正在尝试使用ADODB验证oracle DB中的数据。我安装了Oracle Client x64位并正确配置了环境变量。出于某种原因,下面的代码抛出了automation error
,这对缩小问题并没有多大帮助。
PS:我也尝试过安装32位版本的oracle客户端。
Sub test()
myHost = ""
Database_Name = ""
myUsername = ""
myPassword = ""
serviceID = ""
myPort = ""
strConnectionString = "Driver={Oracle in OraClient11g_home1}; " & _
"SERVER=(DESCRIPTION=" & _
"(ADDRESS=(PROTOCOL=TCP)" & _
"(HOST=" & myHost & ")(PORT=" & myPort & "))" & _
"(CONNECT_DATA=(SERVICE_NAME=" & serviceID & "))); uid=" & myUsername & ";pwd=" & myPassword & ";"
Debug.Print strConnectionString
'Instantiate the Connection object and open a database connection.
Set cnn = CreateObject("ADODB.Connection")
cnn.Open strConnectionString
'Above line throws error
End Sub
错误消息
*
Microsoft Visual Basic for Applications
运行时错误'-2147217843(80040e4d)':自动化错误确定帮助
*
考虑联系专家支持。
答案 0 :(得分:0)
我无法在OraClient11g_home1 驱动程序中使用 Oracle。所以我安装了32位 Microsoft ODBC for Oracle 并完成了工作。
x = linspace(0, 2*pi, 100);
hl = plot(x, [sin(x); cos(x); tan(x); nan(size(x))].'); % Add a line of NaNs
axis([0 2*pi -4 4]);
[~, objH] = legend(hl([1 2 4 3]), 'sin', 'cos', 'junk', 'tan'); % Reorder handles
set(findobj(objH, 'Tag', 'junk'), 'Vis', 'off'); % Make "junk" lines invisible
pos = get(objH(3), 'Pos'); % Get text box position
set(objH(3), 'Pos', [0.1 pos(2:3)], 'String', 'also...'); % Stretch box and change text