Versions Compared

Key

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


Div
idProductTOC

On this page

Table of Contents
maxLevel2
excludeOn this page
typeflat
separatorpipe

Include Page
_SQL for Confluence 11.x announcement
_SQL for Confluence 11.x announcement

Overview

SQLSQL File, and SQL Query macros use data sources to connect to and access your databases. Creating one or more data source profiles is the fastest and most convenient method of establishing a connection. You can also create data source profiles that extend data sources configured within your application server.

Info

You must provide at least one data source to use this application within Confluence.

...

DatabaseExample
PostgreSQLdbUrl=jdbc:postgresql://localhost:5432/test | dbUser=confluence | dbPassword=confluence | dbDriver=org.postgresql.Driver | dbJar=https://jdbc.postgresql.org/download/postgresql-42.2.5.jar
PostgreSQL (using specific Schema)

dbUrl=jdbc:postgresql://localhost:5432/test?currentSchema=jiraschema | dbUser=confluence | dbPassword=confluence | dbDriver=org.postgresql.Driver | dbJar=https://jdbc.postgresql.org/download/postgresql-42.2.5.jar 

MySQL

dbUrl=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true | dbUser=confluence | dbPassword=confluence | dbDriver=com.mysql.jdbc.Driver | dbJar=http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar

Microsoft SQL Server

dbDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver | dbUrl=jdbc:sqlserver://localhost:2433;database=test;integratedSecurity=false | dbUser=confluence | dbPassword=confluence | dbJar=../lib/mssql-jdbc-7.0.0.jre8.jar

...

ParameterMacro ParameterDefaultDescription
Limit rows processedlimitNo limit

The maximum number of rows to be processed and displayed by SQL macros. This prevents queries that result in a large number of rows from using excessive resources. Individual queries can use the limit parameter to override this value. The following options are available from a selection list:

  • No limit
  • 250 (Recommended)
  • 500
  • 1,000
  • 2,500
  • 5,000
  • 10,000
  • 15,000
  • 20,000
  • 25,000
Limit query timequeryTimeoutNone

The number of seconds that a query can take before a forced timeout. This prevents queries that take too long from impacting other users. Individual queries can use the queryTimeout parameter to override this value. 

Info

Note, this parameter:

  • Requires that the target database and JDBC driver support the remote query timeout server configuration option (queryTimeout). 
  • Administrators can limit (or control) who can use this parameter through the use of our CMSP app.
  • To know more about how the queryTimeout parameter value is evaluated, refer to the scenario page Limit query time - 11.x.


Limit max activemaxActiveNoneLimit the number of actively executing SQL queries for a specific data source. Once the maximum active limit is reached, the next requested render of a SQL macro using the specific data source returns an error message instead of trying to connect to the database. See this article for additional information.
Show sql optionsshowSqlOptionsNoneA comma-separated list of code or code-pro (Code Pro Macro) parameters used when Show SQL is selected. This allows for customization of how the SQL code is shown. See How to improve the display of SQL source. Since 6.4
Connection propertiesconnectionPropertiesNoneA list of driver specific properties passed to the driver for creating connections. Each property is given as name=value, multiple properties are separated by semicolons (;). See Apache Tomcat JNDI resources.
Initial SQLsinitalSql<n>None

SQL that is run after the SQL connection is established where n is a number (1, 2, 3, ...). Multiple initial SQL statements are allowed to support databases that only allow single SQL statements. Example use for Oracle:

Code Block
languagetext
initialSql1=ALTER SESSION SET NLS_TERRITORY = GERMANY|initialSql2=ALTER SESSION SET NLS_LANGUAGE = GERMAN

No results are kept and any errors generates a macro exception. Using beforeSql is recommended for Postgres and other database that support multiple SQL statements as it is more efficient than multiple separated actions.

Before SQLbeforeSqlNoneSQL that is added before macro defined SQL.
After SQLafterSqlNoneSQL that is added after macro defined SQL.

...

  1. Log in as a user with the Confluence administrators Global Permission.
  2. Select Manage apps from the CONFLUENCE ADMINISTRATION menu (cog icon: ) at the top right of your screen.
  3. Scroll down to BOB SWIFT CONFIGURATION in the navigation pane to the left and click SQL (Pro Edition) (see:).
  4. Click View and modify data source profiles (see:) tab at the top.
  5. You will see a list of data source profiles and their connection status.

...

  1. Log in as a user with the Confluence administrators Global Permission.
  2. Select Manage apps from the CONFLUENCE ADMINISTRATION menu (cog icon: ) at the top right of your screen.
  3. Scroll down to BOB SWIFT CONFIGURATION in the navigation sidebar to the left and click SQL (Pro Edition) (see: ).
  4. Click View and modify data source profiles (see:) tab at the top.
  5. You will see a list of data source profiles and their connection status.
  6. Click the Edit link to the right of the data source profile you would like to modify.
  7. The edit dialog will appear and will default to the By connection string view. You can edit the fields under this option or toggle to the Simple setup type and make the necessary changes. 

    Info

    You will be able to toggle to the Simple setup type only after clearing the configuration information that appears under the By connection string.


  8. To save changes, click the Next and then Save profile (see:).

...

  1. Log in as a user with the Confluence administrator's Global Permission.
  2. Select Manage apps from the CONFLUENCE ADMINISTRATION menu (cog icon: ) at the top right of your screen.
  3. Scroll down to BOB SWIFT CONFIGURATION in the navigation pane to the left and select SQL (Pro edition) (see:).
  4. Click View and modify data source profiles (see: ) tab at the top. You see a list of data source profiles and their connection status.
  5. Click the Remove link to the right of the data source profile that you want to remove.
  6. Click Yes, delete it!.

...