Previous Thread:   EndSession is throwing an error

5/11/2006 11:59:03 AM    SessionID
Hello,  
  
I have a question. I don't know how to use SessionID property of the  
  
AdomdConnection.  
  
I thought that once I open connection, I can get it and then after  
  
disconnecting, use it to connect to the same session. This way I wanted to  
  
implement connection pooling.  
  
My code looks like this:  
  
AdomdConnection connection=new AdomdConnection(...);  
  
connection.Open();  
  
string sessionID = connection.SessionID;  
  
....  
  
connection.Close(false);  
  
.....  
  
connection.SessionID = sessionID;  
  
connection.Open(); <--- and here I got exception: The Session, '..' does not  
  
exists.  
  
.....  
  
What am I doing wrong here ?  
  
Best regards  
  
Peter



5/11/2006 3:32:19 PM    Re: SessionID
hello Peter,  
  
just to clarify a bit more: could you provide some details as to what server  
  
you are connecting to (AS2000 or AS2005) and what version of adomd.net you  
  
are using?  
  
in general, the session id could be used to work with the same session with  
  
multiple connections (or maybe when you want to work with the same session  
  
with both oledb and adomd.net connection for example). usually you would  
  
open a connection, get it's session id and assign that session id to the  
  
other connection object before opening it.  
  
however, i'm not sure that the way you'd like to use this would always work.  
  
indeed, using the connection.Close(false) should instruct adomd.net to not  
  
to send the "end session" request to server and the session would be alive  
  
when connection is closed. however, if there are no active connections  
  
associated with this session id, server might decide to drop the session  
  
(after certain time had elapsed), and thus next time you try to use it  
  
session might be already gone. can it be the case in your example? or you  
  
see that the session is always gone even if you re-connect right away?  
  
hope this clarifies some,  
  
- mary  
  
"Reda" <piotr.nusbaum@domdata.com> wrote in message  
  
news:e3v1lo$64g$1@helios.domdata.com...

5/12/2006 11:13:33 AM    Re: SessionID
I've made some additional testing and I know already what the problem is.  
  
I've made tests using both Adomd8.0 and Adomd9.0, and connecting to AS2000  
  
The problem was, that in my connection string I didn't specified Initial  
  
Catalog.  
  
Every time, after Open, I executed ChangeDatabase method, which changed  
  
SessionID value and made it impossible to reuse this session in next  
  
connections.  
  
Please correct me if I am wrong, but this means that sessions can be used in  
  
fact only if I specify InitalCatalog in connectionstring. Am I right?  
  
best regards  
  
Peter  
  
U¿ytkownik "Mary Potapova [MS]" <marypo@online.microsoft.com> napisa³ w  
  
wiadomo¶ci news:OhdOGrUdGHA.3908@TK2MSFTNGP04.phx.gbl...  
  
server  
  
with  
  
work.  
  
to

5/12/2006 1:43:07 PM    Re: SessionID
hello Peter,  
  
Yes, i think you are correct in that Changing database (when working against  
  
AS2000 server) involves creating a new session.  
  
So i guess that when working against AS2000 indeed you should specify  
  
database in the connection string, otherwise calling ChangeDatabase would  
  
create a new session.  
  
It should not be the case when working with AS2005.  
  
however, please remember that session left behind might get expired, so the  
  
code should be prepared to handle that.  
  
-mary  
  
"Reda" <piotr.nusbaum@domdata.com> wrote in message  
  
news:e41jcb$5ie$1@helios.domdata.com...