Page tree

Versions Compared

Key

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

This tutorial is valid for ConfiForms plugin as well (when you setup your database connections)



We will start with configuration of the datasource (connection to database)

...

However, ConfiDoc can connect and show the data from any database, as long as you provide the database driver, have network access to that database from your Confluence server and provide correct connection details.

 


  1. Database connection setup for ConfiDoc
  2. Using this connection to show the data on Confluence page
    1. as table
    2. as list (with very custom layout)
  3. Making sure the connection usage is restricted to be used by Confluence admins only (the results will be shown to any user who has permissions to view the page where results are shown)

 


Let's start with #1

Connections to any sources (with ConfiDoc) are configured by Confluence admins. This is to enable single point of control and awareness of the systems integrated trhough ConfiDoc into Confluence.

...

And then looking into ConfiDoc add-on listing

 


And clicking on "Configure" button. You will be directed to the URL, similar to this

...

Warning

Important bit is that if you connect to external database you will need to place a JDBC database driver to your database into Confluence installation directory under WEB-INF/lib or even into shared libraries to avoid classloading issues

Preferably, it should be in <install-dir>/lib - this is the directory that has other tomcat jars. If you have a much older version of Confluence that does not have this directory, look for <install-dir>/common/lib instead.


Here is what we have configured in this tutorial:

 

 

 

 

 

 

 

...

Image Added

You can use "Test" button to test the connection (access, authorization) and permissions (database permissions in this case)

Click, "Save" and we are done with configuration



Now we can move on to #2 and create some views over the data

The table we query has 3 columns, and just 2 rows at the moment

You can see this by placing one of the views macros (TableView, ListView or PlainView) and seeing it in the preview mode


Image Added

Here is the live data from this configuration:

  • as Table (ConfiDoc TableView)

    ConfiDoc TableView Macro
    serviceIdfa7cbd79-df33-4978-a9ea-889c3da17902

    nameName

    linkLinkLink
    Expand
    titleConfiguration in storage format
    Code Block
    <ac:structured-macro ac:macro-id="58f5fa4c-3ee3-4e71-bbb4-b70fb611ab17" ac:name="confidoc-table" ac:schema-version="1">
            <ac:parameter ac:name="serviceId">fa7cbd79-df33-4978-a9ea-889c3da17902</ac:parameter>
            <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
            <ac:rich-text-body>
              <p>
                <ac:structured-macro ac:macro-id="ab84a999-05b9-4803-9675-5ccbe90fa386" ac:name="confidoc-field" ac:schema-version="1">
                  <ac:parameter ac:name="name">name</ac:parameter>
                  <ac:parameter ac:name="label">Name</ac:parameter>
                </ac:structured-macro>
              </p>
              <p>
                <ac:structured-macro ac:macro-id="1e2b6020-2442-4c07-828c-6e3092045310" ac:name="confidoc-field" ac:schema-version="1">
                  <ac:parameter ac:name="name">link</ac:parameter>
                  <ac:parameter ac:name="label">Link</ac:parameter>
                  <ac:parameter ac:name="type">Link</ac:parameter>
                </ac:structured-macro>
              </p>
            </ac:rich-text-body>
          </ac:structured-macro>
  • as List (ConfiDoc ListView)

    ConfiDoc ListView Macro
    serviceIdfa7cbd79-df33-4978-a9ea-889c3da17902

    nameName

    linkLinkLink
    Expand
    titleConfiguration in storage format
    Code Block
    <ac:structured-macro ac:macro-id="57192aef-e4cd-428b-9a7c-9ef95d572ba8" ac:name="confidoc-list" ac:schema-version="1">
     <ac:parameter ac:name="serviceId">fa7cbd79-df33-4978-a9ea-889c3da17902</ac:parameter>
     <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
     <ac:rich-text-body>
     <h1>
     <ac:structured-macro ac:macro-id="a78f4fc3-a32b-49ef-948b-4561e03aec23" ac:name="confidoc-field" ac:schema-version="1">
     <ac:parameter ac:name="name">name</ac:parameter>
     <ac:parameter ac:name="label">Name</ac:parameter>
     </ac:structured-macro>
     </h1>
     <div>
     <ac:structured-macro ac:macro-id="be458501-230a-4467-b11b-63e7313baa11" ac:name="confidoc-field" ac:schema-version="1">
     <ac:parameter ac:name="name">link</ac:parameter>
     <ac:parameter ac:name="label">Link</ac:parameter>
     <ac:parameter ac:name="type">Link</ac:parameter>
     </ac:structured-macro>
     </div>
     </ac:rich-text-body>

#3 is an option step, which allows you to setup restrictions on ConfiDoc configuration usage.

Go to ConfiDoc connections administration UI and click on edit for our "demo table connnection"

The last setting on the form will help you to define which users and user groups are allowed to use this connection

We set it to be used by "confluence-administrators" group

Image Added



Info
titleOther database connection strings can be found here:


ConfiDoc Excerpt Macro
rootdiv id="db_drivers"
values8159330
serviceId54196d34-4e26-4e0b-801b-b565e28fc70f