我正在尝试使用Excel VBA连接到工作区服务器。使用this page上的信息,我产生了以下内容:
Dim obSAS As SAS.Workspace
Dim obWorkspaceManager As New SASWorkspaceManager.WorkspaceManager
Private Sub Form_Load()
Dim obConnection As New ADODB.Connection
Dim obRecordSet As New ADODB.Recordset
Dim obServerDef As New SASWorkspaceManager.ServerDef
Dim xmlString As String
obServerDef.Port = 28561
obServerDef.Protocol = ProtocolBridge
obServerDef.MachineDNSName = "blah.server.com"
Set obSAS = obWorkspaceManager.Workspaces.CreateWorkspaceByServer( "Ref", _
VisibilityProcess, obServerDef, "me@saspw","MyPass", xmlStr)
end sub
我的第一反应是:
<xml id="combridgeOutput"><connectionAttempts><connectionAttempt>
<sasserver></sasserver>
<sasmachinednsname>blah.server.com</sasmachinednsname>
<sasport>28561</sasport>
<saslogin>me@saspw</saslogin>
<status>0x80041001</status>
<description><Exceptions><Exception>
<SASMessage severity="Error">
The client has connected to a SAS (9.2) Metadata Server (v1.0) when
it intended to connect to a SAS Workspace Server.
</SASMessage>
</Exception></Exceptions></description>
</connectionAttempt></connectionAttempts></xml>
所以我更新了端口号以指向工作区服务器,现在我得到了这个:
<same XML tags as above >
<SASMessage severity="Error">
Client me@saspw does not have permission to use server
SASMeta - Workspace Server (A5DPDN69.AV000069).
</SASMessage>
宁愿不为此练习设置特殊权限。如何将VBA连接到SAS工作区服务器会话?
答案 0 :(得分:3)
卫生署!我使用错误的机器名称。作为参考,这是获取正确机器名称的过程!
您将看到正确的机器,并且还会显示端口详细信息..