Why can't Power Scripts for Confluence use the database to run SIL script?
Asked by Alexandra Mihaela Mateescu:

Hello,

We have a SIL script in Confluence that retrieves / uses data directly from the database and it refuses to work. We believe to be a problem of the Power scripts plug-in that connects to the datasource.  
The same script is used in JIRA and there it works, but it refuses to do so in Confluence.  
The Database Connection URL from System Information found in Confluence Administration section is the same as the one configured in the JDBC URL from Datasources in Confluence Cprime Tools section.  
Also, if we try to connect to the database locally we are able to do so, but not with the Power scripts plug-in in Confluence.

Power Scripts for Confluence Installed version: 1.1.6  
Power Scripts for JIRA Installed version: 4.8.0.6  
Confluence database name: PostgreSQL version 42.1.1

Any ideas why this doesn't work?

Thank you!


Answers:
author: Hyrum Steffensen--Cprime
body: Hello Alexandra,

This is an interesting if complicated question. Databases can be finicky which requires some finesse and patience. Usually in such situations as you describe, we suggest opening a support ticket so we can ask additional questions about your setup. That being said, here are a list of things to check:

* Does your query work outside Jira?
* Try performing that same query using the sql() routine.  
  <https://confluence.cprime.io/display/SIL/sql>
* A common mistake is that users misspell their datasource connection when performing their query. Check that the datasource referenced in your query matches l the datasource name. The name is case sensitive.   
  <https://confluence.cprime.io/display/SIL/Configuring+datasources>
* Look for any error messages in the Confluence log files, which are normally found at: \<CONFLUENCE_HOME\>/logs/atlassian-confluence.log

As stated previously, we would love to help you troubleshoot your datasource connection. Please submit a support ticket here:  
<https://jira.cprime.io/servicedesk/customer/portal/2/create/13>  

As always, feel free to stop by chat so we can give you immediate service.

<https://drift.me/hyrumsteffensen>

Regards,

Hyrum Steffensen  
Product Engineer, Power Scripts

comments: author: Alexandra Mihaela Mateescu
body: Hi [@Hyrum Steffensen--Cprime](/t5/user/viewprofilepage/user-id/2226445) ,

Please see below my answers to your questions:

*
  > Does your query work outside Jira? **Yes! Already tries and it works**
* Try performing that same query using the sql() routine.  
  <https://confluence.cprime.io/display/SIL/sql> **Not working since we cannot connect at all to the datasource**
* A common mistake is that users misspell their datasource connection when performing their query. Check that the datasource referenced in your query matches l the datasource name. The name is case sensitive. **Already checked. URL used in datasource si the exact same as the one from System Information section.**   
  <https://confluence.cprime.io/display/SIL/Configuring+datasources>
* Look for any error messages in the Confluence log files, which are normally found at: \<CONFLUENCE_HOME\>/logs/atlassian-confluence.log **Already looked but found nothing important to be noted.**


Tags: power-scripts

confluence-server

cprime

database

postgres

server