Close datastore

I just started code to use the new Open datastore command… I love it, this is a great feature.

Is there a Close datastore(localID) command to terminate the connection and free up the license it uses?

Neil

It closes the datastore automatically if you don’t use the object anymore (if the refCounter = 0).

It must be broken then. I was testing with a local variable $MyDS:=Open datasource… I ran the method. Saw the connection in the Administrator server of the remote server. The method finished executing, hours later the connection was still in the remote server admin window. What version are you using?

Happy hour forum is now online — come have a chat.

Meeting ID: 891 781 2985

Password: 4d4all

Mike

No, not for a datastore.

A remote datastore can be accessed using the returned object (usually stored in a local variable) or by name (useable in other methods or even processes).

 $myds:=Open datastore(connectionInfo;"myLocalId")
 $myds2:=ds("myLocalId")
  //$myds and $myds2 are equivalent
Closing sessions

A session is automatically closed by 4D when there has been no activity during its timeout period. The default timeout is 60 mn, but this value can be modified using the connectionInfo parameter of the Open datastore command.

If a request is sent to the remote datastore after the session has been closed, it is automatically re-created if possible (license available, server not stopped…). However, keep in mind that the context of the session regarding locks and transactions is lost (see above).

If this is not the case for you, please open a TAOW case for investigation/bug report.

2 Likes

This seems accurate, I don’t think this is a bug.

As always Thomas, thank you for your comments.