DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect to DataStore multiple times

Solved!
Go to solution

Hi,

I'm connecting to an ASAM-ODS-Server via

 

Call OdsOpen("AOP5", param, 0, 0)

 

where param is "<corba typ="sessionior">IOR_STRING</corba>". This way, I can connect as many times as I want (every time I start the script). Now I'm trying the more comfortable way with:

 

Set oStore = Navigator.ConnectDataStoreByParameter("AOP5", param)

 

This way, the connection is only created once, when I'm trying to start the script the second time I get the error message "...DataStore "NoName" can't be opened.". The old way with "OdsOpen" didn't work either (ErrorCode 104). What am I doing wrong?

 

With best regards,

Martin Kozlowski

DIAdem 2012

0 Kudos
Message 1 of 3
(5,486 Views)
Solution
Accepted by topic author MartinKozlowski

There is a great difference between OdsOpen and Navigator.ConnectDataStore...

 

  OdsOpen "", "STORENAME", 0, 0
matches
  dim store : set store = navigator.ConnectDataFinder(STORENAME)

 

  OdsOpen "AOP5", "<corba typ=""sessionior"">IOR_STRING</corba>", 0, 0
matches
  dim store : set store = navigator.ConnectDataStoreByParameter("AOP5", "<corba typ=""sessionior"">IOR_STRING</corba>")

 

And here the difference. When the variable store gets out of scope the ASAM ODS Corba session is closed. This would also happen if you terminate your

OdsOpen with the OdsClose that should match it. Else the session will stay open till the server times it out.

 

In your case this means the session with your IOR no longer exists after script has finished.

 

What would work around?

  • You would have to create a global variable in a user command and assign the open to it. The global scope will stay open till you call close or assign nothing.
  • You open the store in Navigator which will keep it open till you close it. (navigator.Display.OpenDataStoreByParameter)

There is an additional difference.

  • OdsOpen will establish one connection to the server for each Open you call. Have a look at File->ASAMDataService and watch all your open stores holding client and server resources
  • navigator.???? will not open a new server connection if the parameter string is equal. So if you want to open it twice append some xml <abc>1</abc> ...

Either way the best way to work like you do it is openeing the store in Navigator GUI. Second best is the global parameter but this one is harder to set up.

Most imports or ASAM scripts that I know work with a single open ....... and a close when script is finished.

 

Hope this helps

Andreas

 

Message 2 of 3
(5,474 Views)

Thank you very much! I will try one of the work arounds for debuging reason.

Once the script runs productively, it will be just perfect if the session is closed automatically when the store variable is out of scope Smiley Happy

0 Kudos
Message 3 of 3
(5,469 Views)