How to Programmatically Check if a Database Connection is Actively in Use Before Deleting It in Ignition Perspective?

Hi Community,

I’m working on a project in Ignition Perspective (v8.1.38) where I need to safely delete a database connection through a user interface.

Before allowing a user to delete a database connection (for example, ignition_test), I want to programmatically check if the connection is actively in use — meaning if other sessions, users, or running scripts are currently utilizing that connection.

Here’s what I’ve discovered so far:

  • system.db.getConnectionInfo(connectionName) provides the connection status (Valid or Faulted), but it doesn’t provide details on active or idle connection counts.
  • The active connection pool statistics are visible in Gateway > Status > Connections > Databases, but I couldn’t find a scripting function to access this data.

What I’m trying to achieve:

Programmatically determine if a database connection is actively in use (for example, via connection pool usage or ongoing queries)
Prevent deletion if the connection is currently active or busy


Questions:

  1. Is there a way to programmatically check active or idle connection counts in Ignition Perspective scripting?
  2. Is there a built-in mechanism to safely handle connection deletion if it is currently in use?
  3. If this is not accessible through scripting, is there any recommended best practice to handle this scenario?

Context:

  • Ignition Version: 8.1.38
  • Scope: Perspective
  • Database Type: MSSQL (but applicable to any)

Thanks in advance for your help!

This seems like a fundamentally misguided thing to do; most critically because just because a connection is not currently being used does not mean it will not ever be used. Ignition's highly dynamic nature makes it effectively impossible to determine whether a connection is used other than by tracking actual usage.

That said, there will be system tags available for each extant database connection which you can monitor:

Thanks sir, this is useful information. But my simple test is only changing one value inside the Tag of Database which is QueriesPerSecond I am not sure how can I use it to detect if a connection is being used. Maybe I can do some kind of logging with time stamp and make the decision.