Question
Leon Stokes · Jan 9, 2020

Best way to programatically determine if you are running Cache or IRIS

Any recommendations - From COS, From .net?

00
2 0 2 247

Replies

From COS -  $SYSTEM.Version.GetVersion()

From SQL - SELECT $ZVERSION

Not a .NET guy, sorry!

Hi,

In .Net, using the managed provider (https://cedocs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GBMP) the connection object has the property ServerZV, that returns the $ZV:

        static void Main(string[] args)
        {
            InterSystems.Data.CacheClient.CacheConnection cacheConn = new InterSystems.Data.CacheClient.CacheConnection();
            cacheConn.ConnectionString = "Server=localhost;Port=1972; Namespace=USER; Password=xxxx; User ID=xxxx";
            cacheConn.Open();

            Console.WriteLine(cacheConn.ServerZV);
            Console.ReadLine();

            cacheConn.Close();
            cacheConn.Dispose();

         }