Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to configure a data source for the "SQL for Confluence" add-on to query JIRA's DB

JamesT
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 30, 2016

We've been using Bob Swift's "SQL for Confluence" add-on for a while.  Until today, all of the data sources were SQL Server and it's worked fine, but now we have to query a PostgreSQL DB.  In fact, it's the DB for our JIRA Server instance.

I'm trying to use the recommended data source config, modified like this to point to the PostgreSQL library included with Confluence 6.0.2.

dbDriver=org.postgresql.Driver |
dbUrl=jdbc:postgresql://jiradbserver:5432/jiradb|
dbUser=username|dbPassword=password|
dbJar=lib/postgresql-9.4.1210.jar

I'm able to interactively query the JIRA DB using my favorite client (HeidiSQL), so I know the basic connection info is working.  But, I think the JIRA DB (or possibly PostgreSQL in general) has a different structure than I'm used to with SQL Server.

In my connection string above, "jiradb" refers to the DB name on that server.  However, JIRA and/or PostgreSQL has an additional level to the data structure, and when I'm querying using HeidiSQL, I also need to select the "next" level down, called "jiraschema" for our JIRA Server's DB.

How do I specify that extra level in the datasource?  I've trying using "postgresql://jiradbserver:5432/jiradb/jiraschema" and other variations, but I can't get it to work.

2 answers

1 accepted

0 votes
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 30, 2016
JamesT
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 30, 2016

Yes!  Using this format works:

dbUrl=jdbc:postgresql://jirasbserver:5432/jiradb?currentSchema=jiraschema
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 30, 2016

Good. Good question too! We always use public so have never thought about it before.

0 votes
JamesT
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 30, 2016

I pointed the data source to our JIRA Test database, which seems to keep everything in the "public" schema, not the "jiraschema" used by the production server.

How do I specify a different schema in the datasource?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events