Sunday 25 March 2012

connect to specific session using AMO?

The following works, but it uses AdomdClient to connect to a specific session. I'm wondering if there's a way to use AMO to connect to a specific session that already exists.

Dim server As New Microsoft.AnalysisServices.Server()

server.Connect("Data Source=myserver")

Dim sOldSession As String = server.SessionID

'do something

server.Disconnect(False) 'disconnect without killing the session

Dim conn As New Microsoft.AnalysisServices.AdomdClient.AdomdConnection("Data Source=myserver")

conn.SessionID = sOldSession

conn.Open() 'works

hello,

there should be a second overload of Server.Connect that accepts sessionId as a second argument.

so something like below should work:

Dim server As New Microsoft.AnalysisServices.Server()

server.Connect("Data Source=localhost")

Dim sOldSession As String = server.SessionID

'do something

server.Disconnect(False) 'disconnect without killing the session

Dim server2 As New Microsoft.AnalysisServices.Server()

server.Connect("Data Source=localhost", sOldSession)

'do something

server2.Disconnect()

hope this helps,

No comments:

Post a Comment