Where possible, you should always use an application’s API to retrieve data rather than its database.
To set up a local database connection and make the local database (the one that your Atlassian application is using) available to scripts, follow these steps:
Navigate toScriptRunner>Resources>Add New Item>Local Database Connection.
Provide a name for the connection inPool Name.
For local connections, we recommend the namelocal.
Optionally, enter a query into theSQLfield to test receiving information from the database. UsePreviewto test out different queries.
This SQL query is not saved and is only used to test the connection.
SQL can be used to run queries harder to achieve using the API.
If the preview is successful, clickAdd.
The local connection is always read-only (except in the case of H2, where this driver does not support it).