Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Teams
, (opens new window)

One Appfire Support Knowledge Base
Results will update as you type.
  • Add Profile for Microsoft SQL Server using SQL for Confluence
  • How to convert text to hyperlinks using SQL queries with SQL for Confluence
  • How to get usage information of an app being used in space templates
  • How to retrieve data with single quotes from Oracle database fields
  • How to display links in SQL results using SQL for Confluence
  • How to resolve an Access denied error - 10.x
  • How to add queries within queries
  • How to resolve an Authentication failed error - 10.x
  • How to avoid format errors when using output=wiki
  • How to resolve broken database connections - 10.x
  • How to resolve a Class not found error - 10.x
  • How to combine queries from multiple databases
  • How to update database columns and display them in a page using Run macro with SQL macro
  • Configure application server based datasources - 10.x
  • Configure data source profiles 10.x
  • How to resolve an Invalid syntax server.xml error
  • How to resolve a Could not create connection to database server error - 10.x
  • Create a chart with SQL - 10.x
  • How to resolve a Data source name not found error - 10.x
  • How to resolve a Database server not found error - 10.x
  • Datasource problem determination - 10.x
  • Example profile configurations
  • Error while retrieving the data using SQL for Confluence
  • How to resolve a Generic SQL exception - 10.x
  • How to find pages that uses a specific data source profile in different SQL macros
  • How to get favorites list of Confluence users using Sql for Confluence
  • How to configure data source profiles for various databases with examples
  • How to do data source problem determination
  • How to handle the "No suitable driver found" error when connecting to an MS-SQL database
  • How to hyperlink the SQL macro results
  • How to implement role based security for SQL queries - 8.x
  • How to improve the display of SQL source - 8.x
  • How to show all table rows using a nested query with SQL for Confluence
  • How to implement role based security for SQL queries - 10.x
  • How to improve the display of SQL source - 10.x
  • How to index SQL data
  • How to use SQL data with inline macros
  • How to resolve a Listener refused connection error - 10.x
  • How to log SQL activity
  • Pro tips
  • How to publish SQL queries on Atlassian Cloud
  • How to run SQL queries securely without page edit restrictions
  • Sample Queries - Confluence Labels
  • How to resolve the Unable to load database driver error
  • How to use Confluence metadata in SQL queries
  • How to use HTML in queries
  • How to use SQL case statement to improve the visual appeal
  • How to use SQL macros securely
  • Using the SQL macro with Markup - 9.x and earlier
  • How to resolve an Oracle validation query throwing exception - 10.x
  • UI caching problem with SQL for Confluence
  • How to create a temporary MySQL table using the SQL for Confluence (Pro edition) app
  • Using SQL File with Markup - 9.x and earlier
  • How to use MySQL functions in SQL macro
  • How to get usage information about the SQL for Confluence app
  • How to create a database profile with read-only access using the SQL for Confluence app
  • How to set SSL connection for SQL server with SQL for Confluence (Pro Edition)
  • Connect SQL macro to MS SQL database using Windows authentication
  • Unable to see table views in SQL macro
  • How to use the Expand array option in SQL for Confluence to view values with line break
  • Use SQL Macro with Markup - 10.x
  • Use SQL File Macro with Markup - 10.x
  • Create a Bar chart using SQL macro
  • Create a Pie chart using the SQL macro
  • Create an xyArea chart using the SQL macro
  • Create an xyLine chart using the SQL macro
  • How to resolve a network error due to invalid database port - 10.x
  • How to resolve isValid exceptions - 10.x
  • How to resolve a Cannot load JDBC driver error - 10.x
  • How to resolve a Permission denied error - 10.x
  • How to resolve a Validation query exception - 10.x
  • How to implement role based security for Postgre SQL database - 10.x
  • How to limit active database connections
  • How to use SQL macro in a Confluence user macro
  • How to use macros parameter within nested SQL queries
  • How to resolve the Unable to connect to database error
  • How to create a chart with SQL - 8.x
  • How to implement role based security for Postgre SQL database - 8.x
  • User Macro with sql-query failed after Confluence upgrade to 7.7 version
  • SSL connection to Oracle DB setup issues in SQL for Confluence
  • Unable to load database driver: com.xxx.jdbc.Driver
    You‘re viewing this with anonymous access, so some content might be blocked.
    /
    How to publish SQL queries on Atlassian Cloud
    Updated Jan 21, 2023

    How to publish SQL queries on Atlassian Cloud

    Jan 21, 2023

    Description

    Atlassian Cloud (formerly OnDemand) restricts the ability to install most apps. So how can you still implement concepts like how to use Confluence for business intelligence and reporting? Or, perhaps you are not allowed to install apps on your own corporate Confluence installation and you would still like to publish SQL or other external data (like Excel data). Now, there is a solution for both of these use cases.

    This article discusses this in terms of Cloud, but it applies equally to other restricted environments. While not as dynamic as using the apps directly, it only takes a few more steps to implement and skills and knowledge gained can also be applied in the other context. 

    This is how the Products page is produced. Automation publishes the page once a day.

    SQL for Cloud

    Please vote for https://appfire.atlassian.net/browse/SQL-243

    Steps

    Some of the elements here are optional depending on what you want to do and how automated you want to be. This section outlines the most automatic and rich example.

    You need:

    1. An instance of Confluence (download edition) installed and running. You need administrator rights.  A $10 starter license is sufficient and an instance can be setup in minutes.

    2. If not already installed, install the following apps:

      • SQL for Confluence - version 4.5 or above

      • Run Self-Service Reports for Confluence (optional) - provides a parameterized page for testing

      • Run CLI actions in Confluence - makes it easy to store the page on the Cloud instance. After installation, configure a profile to get to Cloud

    3. Create a page to test your query page just like you would normally.

    4. Create a publish page using the Run, CLI and SQL Query macros. The key is that the SQL Query produces wiki markup because of output=unrenderedWiki (this is what gets published to Cloud).

      Wiki markup for publish page

      {run:titleRun=Publish |autoRun=true |requestPrefix |replace=profile:confluence:Profile:select::confluence-local::confluence-cloud} {cli:profile=$profile|macros=true} -a storePage --title "Project Summary" --space info --file - --minor --comment "Updated from database" @DATA: \{\{toc:type=flat|separator=pipe|minLevel=3|maxLevel=3} h3. Confluence Apps {sql-query:id=CONF|datasource=myDS|output=unrenderedWiki|columnTypes=S,S,S,S,S,S,S,S,C} select ... {sql-query} {cli} {run}



    5. Copy in your SQL from your test page.

    6. Verify your local published page matches your expectation.

    7. Once satisfied, select the Cloud instance profile and press Publish. Refer to How to automate page rendering in Confluence.

    How to let some macros go unrendered to the published page

    When macros=true is used in the CLI macro, all embedded macros are rendered. This is how the SQL data is generated. However, you may want some macros to not be rendered and remain in the markup so they get rendered on the target page. In this example, it is the TOC macro. Simply escape the open bracket so the renderer does not render it and double up the opening bracket so the CLI macro removes the extra after it is rendered.



    Reduce spam

    • --minor is used on the storePage action to signal a minor update to avoid notifications being sent out - unfortunately, at least some versions of Confluence do not respect this API setting.

    • Put specific and unique IDs on the SQL macro (example: id=CONF). This prevents generating IDs that are different each time the page is updated. If there are no other changes with the data for the update, the page is not be marked as changed, and so, no notifications are sent out.



    {"serverDuration": 14, "requestCorrelationId": "7fc8929aa8d343b69bcf00c7f83f20ae"}