Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


Panel
titleDescription

Returns a dataset of information about a single database connection, as specified by the name argument.

Client permissions restrictions


Panel
titleSyntax

system.db.getConnectionInfo(name)

  • Parameters

String name - The name of the database connection to find information about. Will use the current project's default database connection if a name is not specified.

  • Returns

Dataset - A dataset containing information about the named database connection, or an empty dataset if the connection wasn't found. If a populated dataset is returned, the following data will be given:

ActiveConnections current number of connections in use

Column Name

Description

NameReturns the name of this datasource.
DescriptionReturns the description for this datasource.
DBTypeReturns the database connection type. Example types include PostgreSQL, MSSQL, and Oracle.
DescriptionStatusReturns the description for this datasource.ExtStatusReturns the "best" status of this datasource or of any failover datasources. 
MaxConnectionsReturns the maximum number of connections the underlying pool is configured to use.
NameReturns the name of this datasourcebased on its last tested condition. Typical values include Valid, Faulted, and Reconnecting.
ProblemReturns a string describing the current problem, if the status is not good.
StatusExtStatusReturns the "best" status of this datasource based on its last tested condition. Typical values include Valid, Faulted, and Reconnecting.or of any failover datasources. 
ThroughputReturns number of queries per second, including Insert and Select queries. Throughput will be -1 if idle.
ActiveConnectionsReturns the current number of connections in use.
MaxConnectionsReturns the maximum number of connections the underlying pool is configured to use.
ValidationQueryReturns a SQL query that will be used to validate the status of this datasource. This query should always return at least 1 row.
  • Scope

Gateway, Vision Client, Perspective Session

Note_friendly

The database connection used when called from the Gateway scope is the connection configured on the Gateway scripting project.

Panel
titleCode Examples
Code Block
languagepy
titleCode Snippet - Getting Database Connection Information
# This example checks the database connection type and selects a query format that matches.
 
connectionInfo = system.db.getConnectionInfo()
dbType = connectionInfo.getValueAt(0, "DBType")
if dbType == "MYSQL":
	# mysql format for a column with a space in the name
	query = "SELECT `amps value` FROM pumps"
else:
	# mssql format for a column with a space in the name
	query = "SELECT [amps value] FROM pumps"
Panel
titleKeywords

system db getConnectionInfo, db.getConnectionInfo