ECP Connection to remote data server

Primary tabs


I work on deploying IRIS inside Docker container. I really like %Installer class can automate many steps. I want to establish an ECP connection to a mirror database and then define a remote database on the application server. I have already seen we can create local database and namespace in %Installer. What code is needed to establish ECP connection?


Good morning Eduard,

I have looked at class documentations. Config.* classes are persistant, but I did not see the data server in there. I would use the classes to edit iris.cpf? I think I should check for this before starting the application IRIS container. I will look more into this soon.

Config package is a wrapper over CPF file.

You edit the objects of these classes and CPF file is edited automatically by Caché.

You can check in the CPF file where data server is defined and get the corresponding Config object.

WRC may provide more info I think.

You can do this with:

set props("Address") = serverAddr
set props("Port") = serverPort
set props("MirrorConnection") = 1
set sc=##class(Config.ECPServers).Create(ECPServerName,.props)


set props("Server") = ECPServerName
set props("Directory") = ":mirror:"_mirrorName_":" _databaseName
set sc=##class(Config.Databases).Create(databaseName,.props)

Then you need the Namespace created pointing to that remote database and that can be done via the %Installer (I've not found a way of doing the above with %Installer but you can call class methods for the above from %Installer):

<Namespace Name="${newNS}" Create="yes" Ensemble="0" Code="${SourceCodeNameSpace}">
        <Database Name="${newNS}" Create="no" />

This looks like exactly what I was looking for. Thank you, Jeremy !!!