Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated postgres driver downloads


Div
idProductTOC

On this page

Table of Contents
maxLevel2
excludeOn this page
typeflat
separatorpipe

Overview

SQL Macros such as SQL, SQL-query, and SQL-file use Data Sources to connect 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

Note: You must have at least one Data Source in order to begin using this application within Confluence.

...

Tip

The configuration for other databases is similar to the information found in the examples section on: Data source configuration - application server.


DatabaseExample
PostgreSQLdbUrl=jdbc:postgresql://localhost:5432/test | dbUser=confluence | dbPassword=confluence | dbDriver=org.postgresql.Driver | dbJar=https://jdbc.postgresql.org/download/postgresql-942.3-11022.jdbc415.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-942.3-11022.jdbc415.jar 

MySQLdbUrl=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.34/mysql-connector-java-5.1.34.jar
Microsoft SQL ServerdbDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver | dbUrl=jdbc:sqlserver://localhost:2433;database=test;integratedSecurity=false | dbUser=confluence | dbPassword=confluence | dbJar=../lib/sqljdbc4.jar

...

ParameterMacro ParameterDefaultDescription
Limit rows processedlimitNo limit

The maximum number of rows that will 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 for selection:

  • No limit
  • 250 - Recommended
  • 500
  • 1000
  • 2500
  • 5000
  • 10000
  • 15000
Limit query timequeryTimeoutNone

The number of seconds that a query can take before we force a 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:


Limit max activemaxActiveNoneUsed to limit 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 will return an error message instead of trying to connect to the database. See this article for additional information.
Show sql optionsshowSqlOptionsNoneSince 6.4. A 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.
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 will generate 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.

...

IndicatorDefinition
Indicates that the connection information supplied for the Data Source Profile will allow connections from Confluence to the targeted database. This does not indicate that the Data Source Profile is in use by any Macros on Confluence pages.
Indicates that your connection-specific information is incorrect.  See Troubleshooting Data Source Profile connections.

Modify Data Source Profiles

...