Problem "no more handle left" connections to database Microsoft SQL

Has anyone encountered the problem of too many database handles.

We use the cicode SQLcreate and SQLdispose functions when performing stored procedures.
In the parameters of citect.ini we've set up SQLMaxConnections = 0.
In Hardware alams after a while (when in resource monitor watch 10 connections at port SQL) throws an error "no more free handle left" and we must restarting runtime.
Citect Scada 2016
Windows Server 2012 R2
Redundant

  • I see the [SQL] MaxConnections=0 parameter should allow for unlimited connections. However, the SQLDispose() function's help says "If there is an active SQL connection to a database, the SQL connection has to be closed before disposal." Have you tried calling SQLClose() before SQLDispose()? Also, check if SQLDispose() is returning 0, indicating success. Even if Citect isn't restricting the number of connections, the SQL driver may have a limit.
  • Yes we are using SQLClose(hSQL) before every our SQLDispose(hSQL) like in example Function from help SQLCreate(..).
    Our system have redundancy two servers.
    We see a problem when events occur when servers stop seeing each other.
    We have a local bit to see which server is active and then we run events (tiggers) on PRIMARY or STANDBY with our cicode (Querys, Run Stored Procedures).
    ..
    When the servers cannot be seen, the event is probably done on both servers and the handles are exceeded ?

  • That still does not explain why there are 10 connections active after a while. Could it be that your cicode function aborts before it reaches the SQLClose() command? Might be because of a hardware error or a RETURN statement or when SQLClose() is within an IF condition that is not met at that time.