Macro database-info

Purpose

Show information about datasources available to Confluence and JDBC drivers used to connect to them.

It will also help to figure out which values can be used in Macro database-structure.

This macro was added in version 5.3.3 of the PlantUML Plugin und removed in version 2023.3 (with the Confluence 8 support)

Parameter

All parameters are optional.

NameDescription
datasources

Name of datasources to show information about.

  • comma separated list of datasource names
  • empty: information about all available datasources will be shown

(warning) Datasources must be configured by a Confluence administrator before they can be used. A short guide is given below.

attributes

Names of attributes to show

  • comma separated list
  • empty: all available attributes will be shown

see http://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html

Sample Images

Sample Code

{database-info}
{database-info:datasources=support,confluence|attributes=DatabaseProductName,TableTypes}

Macro Browser

REST API

The functions of this macro are also available via REST.

Configuring a datasource

  1. Edit fileĀ atlassian-confluence-<version>/conf/server.xml
  2. Add each datasource as resource below the following lines

    <Context path="" docBase="../confluence" reloadable="false">
       <Manager pathname=""/>
  3. The configuration depends on the type of database. Some examples:

    <!-- PostgreSQL -->
    <Resource name="jdbc/name_of_datasource"
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="to_be_replaced"
                    password="to_be_replaced"
                    driverClassName="org.postgresql.Driver"
                    url="jdbc:postgresql://dbserver.company.com:5432/dbname"
                    validationQuery="Select 1"/>
    <!-- Oracle -->
    <Resource name="jdbc/name_of_datasource" 
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="to_be_replaced"
                    password="to_be_replaced"
                    driverClassName="oracle.jdbc.driver.OracleDriver" 
                    url="jdbc:oracle:thin:@//dbserver.company.com:1521/dbname"
                    connectionProperties="SetBigStringTryClob=true"
                    validationQuery="select 1 from dual" />
    <!-- MySQL -->
    <Resource name="jdbc/name_of_datasource" 
                    auth="Container"
                    type="javax.sql.DataSource"
                    username="to_be_replaced"
                    password="to_be_replaced"
                    driverClassName="com.mysql.jdbc.Driver" 
                    url="jdbc:mysql://dbserver.company.com:3306/dbname?useUnicode=true&amp;characterEncoding=utf8"
                    defaultTransactionIsolation="READ_COMMITTED"
                    validationQuery="select 1"/>
    
    <!-- Microsoft SQL Server -->
    <Resource name="jdbc/confluence" 
                    auth="Container" 
                    type="javax.sql.DataSource"
                    username="to_be_replaced"
                    password="to_be_replaced"
                    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
                    url="jdbc:sqlserver://<host>:1433;database=<database-name>"
                    validationQuery="select 1"/>
  4. Confluence comes with JDBC drivers for PostgreSQL and MS SQL Server.
    If you want to connect to other databases than an appropriate JDBC driver must be obtained and placed in atlassian-confluence-<version>/lib
  5. Restart Confluence