Question
· Jan 24

Connect to iris from Visual Studio

I am a volunteer at a nonprofit that is attempting to connect to a product that uses InterSystems Cache (Clinisys LIMS). I have not used this database before, but I have used many others (MS-SQL, Oracle, etc.). I am hoping IRIS is compatible enough with Cache for this project. 

I downloaded IRIS. I learned about Terminal [IRIS]. Using it I was able to create a new table, insert data, and retrieve it. I also used the Management Portal to query the new table. It also returned the data.

Next I attempted to connect with Visual Studio (MS VS 2022 Profesional). I downloaded the InterSystems.Data.IRISClient through NuGet. It was published 1/22/2025. It has only 21 downloads. (Quite strange!) 

I am using this C# code:

   var IRISConnect = new IRISADOConnection();
   IRISConnect.ConnectionString = cs.CreateCs();
   IRISConnect.Open();

I have tried many connection strings. This one seems the most promising:

var IRISConnect = new IRISADOConnection(host: "localhost", port: "1972", nsp: "USER", username: "username1234", password: "abcd1234");
IRISConnect.Open();

String queryString = "SELECT * FROM Test.Employee";
IRISCommand cmd4 = new IRISCommand(queryString, IRISConnect);
IRISDataReader Reader = cmd4.ExecuteReader();
while (Reader.Read())
    Console.WriteLine(Reader.GetValue(0).ToString());

Reader.Close();
cmd4.Dispose();
IRISConnect.Close();

The error occurs on the line, IRISConnect.Open(). It read, "IRIS Security Error". 

I am able to login to both the terminal and management portal with the username and password. The namespace "USER" appears in the management portal, so I believe it is okay as well. The port is listed under the "iris all" terminal command.

The SuperUser roles are "%All" in the Management Portal: System > Security Management > Users > Edit User - (security settings): Roles tab: Role Name.

The "Last Reason for Failing to Login" is "ERROR #5002: ObjectScript error: <READ>Logon+118^%SYS.DBSRV.1". 

How can I login to IRIS with .NET?

 

References: 

1) https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

2) https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

3) https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

Product version: IRIS 2024.3
$ZV: 2024.3.0.217.0
Discussion (4)2
Log in or sign up to continue

One possibility is that you don't have the appropriate Service enabled to allow for this connection.  This is pretty easy to check, from the SMP go to:
System Administration > Security > Auditing

If auditing isn't enabled then Enable it and run your test again, then go into View Audit Database and see if there is an access error logged.

It is quite possible that you don't have the Call-in service enabled (I don't think it is by default in Normal or Locked Down instances).  From the first .Net documentation link you provided:

[quote]

If InterSystems IRIS has been installed with security option 2, open the Management Portal and go to System Administration > Security > Services, select %Service_CallIn, and make sure the Service Enabled box is checked. If you installed InterSystems IRIS with security option 1 (minimal) it should already be checked.

[/quote]

Check that out and report back if it solved your issue.