Question
· May 19

Pooling exception: Unable to find original pool for connection and IRIS Security Error

I created a Dotnet api to connect with IRIS database to do some task.
"InterSystems.Data.IRISClient.dll" (NativeAPI) is used in dotnet api to connect IRIS.
I used following code in dotnet to open and close the IRIS connection.

Open Connection
---------------------------
IRISConnection iRISConnect = new IRISConnection();
IRISCommand command = new IRISCommand();
iRISConnect.ConnectionString = "Server=xxxx.com; Port=1972; Namespace=aaa; Password=yyyy; User ID=xxxxxx;";
IRIS NativeAPI = IRIS.CreateIRIS(iRISConnect);
iRISConnect.Open();

Connection Close
--------------------------
command.Dispose();
iRISConnect.Close();
IRISPoolManager.RemoveAllIdleConnections();

For single API call this code is working, But when I call the dotnet API mutliple times, getting following errors. Anyone faced the same issue or is there any solution for this issue.

1. "Pooling exception: Unable to find original pool for connection"
    {"severityLevel":"Error","outerId":"0","message":"Pooling exception: Unable to find original pool for connection","type":"InterSystems.Data.IRISClient.IRISException","id":"5416676","parsedStack":[{"assembly":"InterSystems.Data.IRISClient, Version=4.5.1.0, Culture=neutral, PublicKeyToken=ad350a26c4a4447c","method":"InterSystems.Data.IRISClient.IRISPoolManager.ReleaseConnection","level":0,"line":0},{"assembly":"InterSystems.Data.IRISClient, Version=4.5.1.0, Culture=neutral, PublicKeyToken=ad350a26c4a4447c","method":"InterSystems.Data.IRISClient.IRISADOConnection.Close","level":1,"line":0},{"assembly":"GHIS.Claims.Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null","method":"GHIS.Claims.Domain.Common.DBConnect.ClearPool"
2. "IRIS Security Error"
   {"severityLevel":"Error","outerId":"0","message":"IRIS Security Error","type":"InterSystems.Data.IRISClient.IRISException","id":"60962899","parsedStack":[{"assembly":"InterSystems.Data.IRISClient, Version=4.5.1.0, Culture=neutral, PublicKeyToken=ad350a26c4a4447c","method":"InterSystems.Data.IRISClient.IRISADOConnection.GetServerError","level":0,"line":0},{"assembly":"InterSystems.Data.IRISClient, Version=4.5.1.0, Culture=neutral, PublicKeyToken=ad350a26c4a4447c","method":"InterSystems.Data.IRISClient.IRISADOConnection.processError","level":1,"line":0},{"assembly":"InterSystems.Data.IRISClient, Version=4.5.1.0, Culture=neutral, PublicKeyToken=ad350a26c4a4447c","method":"InterSystems.Data.IRISClient.InStream.readHeader","level":2,"line":0},{"assembly":"InterSystems.Data.IRISClient, Version=4.5.1.0, Culture=neutral, PublicKeyToken=ad350a26c4a4447c","method":"InterSystems.Data.IRISClient.IRISADOConnection.Login","level":3,"line":0},{"assembly":"InterSystems.Data.IRISClient, Version=4.5.1.0, Culture=neutral, PublicKeyToken=ad350a26c4a4447c","method":"InterSystems.Data.IRISClient.IRISPool.CreateNewPooledConnection"

Product version: IRIS 2021.2
$ZV: IRIS for Windows (x86-64) 2021.2.1 (Build 654) Fri Mar 18 2022 06:17:00 EDT
Discussion (1)2
Log in or sign up to continue

If you're not getting the IRIS Security Error every time, only when there's multiple calls, then it's possible you're exceeding your license's allowed number of concurrent connections, so I would check there first. 

Also, the call to IRISPoolManager.RemoveAllIdleConnections() will remove any connections that have been closed but are still in the pool. Calling this after every Connection.Close() will undo any advantages of connection pooling. If you want to disable pooling, you can add "Pooling = False" to the connection string, then the call is unnecessary. If you want to use pooling, you should remove the call to RemoveAllIdleConnections().