databaseAvailable

Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center? Click here !

Availability

This routine is available starting with SIL Engine™ 2.6.5.

Syntax

databaseAvailable(dbstring [, sqlstring])

Description

Checks if the database is available. Optionally, it can check also the availability of the results for the SQL passed in as the second parameter.

 

Parameters

Parameter name

Type

Required

Description

dbstring

string

yes

Datasource JNDI name or the datasource name. For Jira database, this is set to "jdbc/JiraDS" by default, if exported.

sqlstring

string

no

SQL string.

Return type

 boolean (true/false)

Example

Let's suppose in our examples `TextField` is a custom field text already configured for the current Jira server instance and `TestDB` represents the database resource name configured in the server context. For more details see SQL data sources.

Example 1

TextField=databaseAvailable("TestDB"); //will set `TextField` value to `true`

Example 2

TextField=databaseAvailable("TestDB", "select pname from project"); //will set `TextField` value to `true` if the SQL passed in can be executed

Example 3

TextField=databaseAvailable("TestDB", "select pname from inexistentTableName");//will set `TextField` value to `false`, because the SQL passed in cannot be executed

Example 4

TextField=databaseAvailable("InexistentTestDB", "select pname from project");//will set `TextField` value to `false`, because the database resource does not exist

Notes

To configure the data source check the SQL data sources configuration chapter.


See also