Page tree

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)

To make things simpler, we will use the same database used by Confluence, using the same database driver. 

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.

Confligration UI is accessible thorugh the Settings-Add-ons menu (right upper corner)

And then looking into ConfiDoc add-on listing


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

https://YOURSERVER/admin/vertuna/confidoc/config.action

Click on "Add Configuration" button and choose "Database connection" as connection type

You will need to type some technical details in here, and a SQL query which you want tio use with this connection/configuration

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:

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


Here is the live data from this configuration:

#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



Other database connection strings can be found here:


DriverConnection string
MySql/
com.mysql.jdbc.Driver
jdbc:mysql://:/?user=&password=

For mySQL driver you will need to enable "generateSimpleParameterMetadata" parameter


jdbc:mysql://localhost:3306/mydb?generateSimpleParameterMetadata=true
PostgreSQL/
org.postgresql.Driver
jdbc:postgresql://:/?user=&password=
IBMDB2/
COM.ibm.db2.jdbc.app.DB2Driver
jdbc:db2://:/?user=&password=
MSSQL(MicrosoftDriver)/
com.microsoft.jdbc.sqlserver.SQLServerDriver
jdbc:microsoft:sqlserver://:;databaseName=?user=&password=
MSSQL(Weblogic)/
weblogic.jdbc.mssqlserver4.Driver
jdbc:weblogic:mssqlserver4:@:
MSSQL(SprintaDriver)/
com.inet.tds.TdsDriver
jdbc:inetdae::?database=?user=&password=
MicrosoftSQLServer(JTurboDriver)/
com.ashna.jturbo.driver.Driver
jdbc:JTurbo://://user=/password=

Microsoft SQL Server/
com.microsoft.sqlserver.jdbc.SQLServerDriver

jdbc:sqlserver://yourserver.database.windows.net:1433;database=YourDatabase;user=yourusername@yourserver;password=yourpassword;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;

https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-2017

Microsoft SQL Server (aternative, newer) / com.microsoft.jdbc.sqlserver.SQLServerDriver 

jdbc:sqlserver://YourServer:Port;databaseName=YourDatabase

More details on https://docs.microsoft.com/en-us/sql/connect/jdbc/using-the-jdbc-driver

https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-2017

OracleThin/
oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:/@::
Oracle(OranhoDriver)/
com.inet.pool.PoolDriver
jdbc:inetpool:inetora:?database=&user=&password=&sid=
Sybase(jConnect5.2)/
ncom.sybase.jdbc2.jdbc.SybDriver
jdbc:sybase:Tds::?user=&password=
PointBaseEmbeddedServer/
com.pointbase.jdbc.jdbcUniversalDriver
jdbc:pointbase://embedded:/?user=&password=
Cloudscape/
COM.cloudscape.core.JDBCDriver
jdbc:cloudscape:?user=&password=
CloudscapeRMI/
RmiJdbc.RJDriver
jdbc:rmi://:/jdbc:cloudscape:?user=&password=
Firebird(JCA-JDBCDriver)/
org.firebirdsql.jdbc.FBDriver
jdbc:firebirdsql://:/?user=&password=
IDSServer/
ids.sql.IDSDriver
jdbc:ids://:/conn?dsn=''
InformixDynamicServer/
com.informix.jdbc.IfxDriver
jdbc:informix-sqli://:/:INFORMIXSERVER=
InstantDB/
org.enhydra.instantdb.jdbc.idbDriver
jdbc:idb:
Interbase(InterClientDriver)/
interbase.interclient.Driver
jdbc:interbase:///
HypersonicSQL/
org.hsql.jdbcDriver
jdbc:HypersonicSQL:?user=&password=







  • No labels