From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect Data Store By Parameter

If I run a script and use OpenDataStoreByParameter, how can I access that particular connection in future runs of that script?  

 

So, the problem is, it seems, every time I use OpenDataStoreByParameter, our server creates a new connection, and checks out a new license.  Even if I use the datastore.close procedure, it appears the server license is still checked out.  This causes our ODS server to stop responding since it is out of licenses, which is a problem. We are still looking into why the server doesn't release the license, even when I use the close procedure, but in the meantime...

 

Is there any way for me to check a previous connection to an AOP5 database if I use OpenDataStoreByParameter? 

0 Kudos
Message 1 of 3
(3,499 Views)

What DIAdem does:

  • if you are calling
    Navigator.ConnectDataStoreByParameter("AOP5", myDataStoreParam)
    twice only one store is opened. and you get two references to it.
    This will happen as long as The parameters are equal.
  • If the param string is different by a single character you will get a new store.

What does close do?

  • Close will close all objects created with this store and free the refrerences.
    So all InstanceElments, EntityElements, ... of this store become invalid.
  • Normally this will call AoSession::close and free your license.

In your case it seems that you opened the store multiple times. And that some

elements of the second store remain active. Global variables, script not finished and not set to nothing, ...

 

Option Explicit

Dim myDataStoreParam: myDataStoreParam = "<cfg loglevel=""2""></cfg><corba typ=""locator""><server port=""900"">10.89.2.24</server><path>ENGINE1.ASAM-ODS</path></corba><user>System</user><pwd e=""1"">puma</pwd>"
dim store1 : set store1 = Navigator.ConnectDataStoreByParameter("AOP5", myDataStoreParam)
dim store2 : set store2 = Navigator.ConnectDataStoreByParameter("AOP5", myDataStoreParam)
dim store3 : set store3 = Navigator.ConnectDataStoreByParameter("AOP5", myDataStoreParam & AlwaysOpenParam)

dbm "DIA: ****  Close store1"
store1.Close
dbm "****  Set store1 to nothing"
set store1 = nothing
dbm "DIA: ****  store1 is not closed because still store2 reference"

dbm "DIA: ****  Close store3"
store3.Close
dbm "DIA: ****  Store3 closed by calling AoSession::close"
dbm "DIA: ****  Set store3 to nothing wll cause no action"
set store3 = nothing
dbm "DIA: ****  Store2 still has first connection"

dbm "DIA: ****  Script will finish now and automatically release store2"


Function AlwaysOpenParam()
  AlwaysOpenParam = "<alwaysopennew>" & Cstr(CDbl(now)) & CStr(rnd(1000)) & "</alwaysopennew>"
end function

Can show this behavior.

Use DebugView to see the following lines.

 

[22624] DIA: ****  Close store1
[22624] DIA: ****  store1 is not closed because still store2 reference
[22624] DIA: ****  Close store3
[22624] AOP5: Info(00): Closing AoSession! 
[22624] DIA: ****  Store3 closed by calling AoSession::close
[22624] DIA: ****  Set store3 to nothing wll cause no action
[22624] DIA: ****  Store2 still has first connection
[22624] DIA: ****  Script will finish now and automatically release store2
[22624] AOP5: Info(00): Closing AoSession! 

Why does it behave this way. Its done to avoid using to may licenses. So opening with the same parameters will reuse the connection.

But in your case it causes the system not to close.

 

The question is. Where do you store references to instances connected to a store.

0 Kudos
Message 2 of 3
(3,481 Views)

Thanks Andreas.  With your information, I was able to better understand the AOP5 log. I was careful to ensure that each instance I called the connect data store by parameter function, I was calling the oDataStore.Close method as well.  

 

So, It appears that I am closing the data store properly, as I get the "Closing AoSession" in my log.  It appears the issue may not be with Diadem. 

 

Thanks. 

0 Kudos
Message 3 of 3
(3,448 Views)