Error rendering macro 'sql-query'

I just installed the Bob Swift SQL plugin and am trying to display anything just to get familiar with the tool to evaluate if it meets our needs.  I am accessing my moc mysql confluence database and tried to run this basic command:

SELECT * FROM conf.SPACES
where SPACETYPE='global';

with this config:

jbDriver=com.mysql.jdbc.Driver | jbUser=<username>| jbPassword=<password> | jbURL=jdbc:mysql://bos-mysqltest1/conf?autoReconnect=true&amp;sessionVariables=storage_engine%3DInnoDB&amp;useUnicode=true&amp;characterEncoding=utf8 | dbJar=/opt/atlassian/apps/confluence/confluence/WEB-INF/lib/mysql-connector-java-5.1.11.jar

I am getting this error:

Error rendering macro 'sql-query' : Security restricted macro is not allowed. An edit restriction is required that matches the macro authorization list.

It is probably my configuration but I am not real sure how to find out.  I read the documentation and installed the macro security plugin as well and added these lines to my macro-security.properties

sql-file=*ANY
sql-file.datasource.*=*ANY
sql-file.file.example.sql=*ANY

Do I have to reboot Confluence?  Anything else I am doing wrong?

Conf version 5.6.2 plugin version 7.1.1

Thanks in advance!

Robert

2 answers

1 accepted

Turns out that I needed to unclick enable under macro security, which makes me wonder why I needed to use that in the first place as I am not concerned about the macro security, I only want to display databases in Confluence.

When you have macro security enabled, you need to configure each macro that you want to use. In your case, you are using the sql-query macro, so add and apply the following to your macro security configuration at least temporarily until you determine the security you need for your sql use. You will need something if you want to also use the sql macro. No reboot is needed.

sql-query=*ANY
sql-query.datasource.*=*ANY

Macro Security Managed Macros has more information on this topic.

Thanks for the response Bob, but I get this error even when trying to use a file based query. I also tried the steps for running without the Macro Security plugin and I got the same results. I cannot find the link but it was instructions on how to run the SQL macro without the Security one. Anyhow, I add the two lines above and get the exact same error. Here is what shows up in the log file: 2015-03-23 09:13:54,093 WARN [http-bio-8090-exec-2388] [xhtml.view.macro.ViewMacroMarshaller] marshalInternal Exception executing macro: sql-query, with message: Security restricted macro is not allowed. An edit restriction is required that matches the macro authorization list. -- url: /confluence/display/BD/Conftest+SQL+experimentation | page: 74096866 | userName: robertn | referer: https://cww-us.comsol.com/confluence/display/BD/Business+Development | action: viewpage

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,932 views 27 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you