Description | Macros | Compatibility | Security | Documentation | Datasource configuration | Usage | Release history
|
Additions and corrections to above
DescriptionDisplays the result table or values from the SQL query on a Confluence page. Data from single or multiple results sets are formatted, usually as a table, for display. Multiple SQL statements (semi-colon separated) can be specified within a single sql macro body (subject to support provided by specific databases).
Macros
|
Reviews and more informationCompatibility
Security
|
Documentation
Parameters
In addition to the parameters listed below, this macro supports Common table capabilities.
- dataSource - Required parameter. Specify the datasource name defined in the application server. Do not use the standard prefix (java:comp/env/jdbc/) as it is added automatically. Formerly called the jndi parameter which will remain valid for upward compatibility.
- output - Determines how the output is formated:
- html - Data is output as a HTML table (default).
- wiki - Data is output as a Confluence wiki table. Use this option if you want data within the table to be formated by the Confluence wiki renderer.
- script - Location of sql statement. Default is the macro body only.
- #filename - Data is read from the file located in confluence home directory/script/filename. Subdirectories can be specified.
- global page template name - Data is read from a global page template.
- space:page template name - Data is read from a space template.
- ^attachment - Data is read from an attachment to the current page.
- page^attachment - Data is read from an attachment to the page name provided.
- space:page^attachment - Data is read from an attachment to the page name provided in the space indicated.
- heading - Number of rows to be considered heading rows (default is 1 row). Specify heading=false or heading=0 to not show any heading lines. Heading rows do not participate in sorting.
- border - The border width in pixels. Defaults to normal table border width.
- width - The table width in pixels. Default is 100%.
- rowOrientation - By default, data is oriented with rows appearing vertically (in rows) and columns in columns. Specify rowOrientation=horizontal to have rows appear horizontally (as columns) and columns appear as rows.
- columnLabel - By default, database column names are used as column labels. Specify columnLabel=true to have database column labels used for column labels. Note that most databases default the column label to be the column name when no explicit column label is provided. Fly-over text for a column label will be the column name when columnLabel=true. Fly-over text for a column label will be the database column label when columnLabel=false or by default.
- escape - When wiki output is requested (output=wiki), some special characters (like '|', '[', ']', '{', '}') in data may cause undesirable formatting of the table. Set escape=true to allow these special characters to be escaped so that it will not affect the formatting. The default is false so that data that has wiki markup will be handled correctly.
- convertNull - Default is true. Converts SQL NULL values to blank. Set to false to have NULL values show up as 'null'.
- table - Default is true. Set to false to not format the data in a table. This option can be used to run queries that produce single values that you want to include in text.
- noDataError - Default is false. Set to true to show an macro error when no data is returned from the query.
- expandArray - Default is true to have array fields expanded one entry per line for vertical row orientation.
- showSql - Default is false. Set to true to show a panel with the sql statement.
- macros - Default is false. Set to true to resolve any macros in the sql statement.
SQL parameter markers
SQL supports parameter markers in statements - these are identified by ?'s in the SQL statement. Parameters p1, p2, ... are substititued for the parameter markers. This can be used to parameterize complex scripts stored as attachments or files.
- p1 - first parameter marker
- p2 - second parameter marker
- ... - ...
Datasource configuration
- SQL plugin datasource configuration and problem determination
Usage
{sql-query:dataSource=TestDS|output=wiki}
select * from test
{sql-query}
There are *{sql-query:dataSource=TestDS|table=false} select count(*) from test01 {sql-query}* rows in table test01
{sql-query:dataSource=TestDS|p1=%test%|showsql=true}
select * from test01 where a1 like ?
{sql-query}
Release history
| Version | Date | State | License | Price |
|
|
04 Oct 2009 | Stable | Freeware / Open Source (BSD) | Free |
|
|
04 Jan 2009 | Stable | Freeware / Open Source (BSD) | Free |
|
|
25 Apr 2008 | Stable | Freeware / Open Source (BSD) | Free |
|
|
22 Jun 2007 | Stable | Freeware / Open Source (BSD) | Free |
|
|
13 May 2007 | Stable | Freeware / Open Source (BSD) | Free |
|
|
25 Mar 2007 | Stable | Freeware / Open Source (BSD) | Free |
|
|
04 Mar 2007 | Stable | Freeware / Open Source (BSD) | Free |
|
|
08 Jan 2007 | Stable | Freeware / Open Source (BSD) | Free |
|
|
26 Sep 2006 | Stable | Freeware / Open Source (BSD) | Free |
|
|
24 Sep 2006 | Prerelease | Freeware / Open Source (BSD) | Free |
- Previous versions were included in Scripting and External Content Macros
Release 3.6.0
| JIRA Issues (5 issues) | ||||||
|---|---|---|---|---|---|---|
| Key | Priority | Summary | Updated | asignee | Reporter | Status |
| SQL-71 |
|
SQL Plugin Errors on first connection | Feb 08, 2010 | Geoff Scott |
|
|
| SQL-60 |
|
Datasource not found when rendered via SOAP API | Oct 04, 2009 | Bob Swift |
|
|
| SQL-58 |
|
SQL macros broken by RTE in Confluence 3 | Nov 16, 2009 | Don Willis |
|
|
| SQL-56 |
|
Change macro type to inline | Nov 09, 2009 | Don Willis |
|
|
| SQL-51 |
|
syntax error in notation guide for sql-query | Oct 04, 2009 | stephan krull |
|
|
Release 3.5.0
| JIRA Issues (4 issues) | ||||||
|---|---|---|---|---|---|---|
| Key | Priority | Summary | Updated | asignee | Reporter | Status |
| SQL-47 |
|
giving name to some columns fails the queries (e.g. select l.NAME AS "label name") | Jan 05, 2009 | Vincent Kopa |
|
|
| SQL-45 |
|
Unexpected program error: java.sql.SQLException: Column 'pkey' not found | Jan 04, 2009 | Victor Rodrigues |
|
|
| SQL-44 |
|
Connections not returned to original state | Jan 04, 2009 | Bob Swift |
|
|
| SQL-42 |
|
adding sql2, sql3, sql4 ... as done with the query-macro | Jan 04, 2009 | Philipp Klauser |
|
|

Comments (344)
Aug 22, 2005
Jeff Hatfield says:
Wiki markup would be a great thing to have in this macro, I hope it makes it! A...Wiki markup would be a great thing to have in this macro, I hope it makes it!
Another feature I'd like to see is the ability to handle multiple result sets, as when you use a COMPUTE statement. That would make it the one SQL macro that does everything!
Feb 06, 2006
Rickard Hansson says:
Yea!Yea!
Mar 18, 2006
Bob Swift says:
Multiple results sets is tracked by SCRP-63.Multiple results sets is tracked by SCRP-63.
Feb 03, 2008
xia yongjie says:
Hello~~ Is this feature implemented?Why do I always get error notificatoins...Hello~~ Is this feature implemented?Why do I always get error notificatoins when I try to use multiple SQL statements (semi-colon separated).
Actually, there are not any syntax error. Just two select statement, like "select * from student; select * from school";
Could you explain any reason?
Feb 03, 2008
Bob Swift says:
Yes, multiple results sets are implemented. You need a sql statement that is va...Yes, multiple results sets are implemented. You need a sql statement that is valid for your database and your database is saying your sql is not valid. I know earlier versions of mySQL did not allow multiple statements on a single request for instance. Postgres allows for semi-colon separated statements. Whatever sql statement you use, make sure it works when submitted through your database admin tool or favorite sql tool.
Aug 30, 2005
Orion says:
The following error is prompted when trying to use the sql macro. Any suggestion...The following error is prompted when trying to use the sql macro. Any suggestions?
"sql: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context"
I have two instances of Confluence running: one with the default database and the other is using Oracle. I have tried to implement the sql macro with both instances without succeeding. Thanks in advance.
Aug 30, 2005
Daniel Ostermeier says:
How are you connecting confluence to the database? ie: are you using a datasourc...How are you connecting confluence to the database? ie: are you using a datasource bound to the application containers JNDI or did you select the direct connection option? In the case of the direct connection option, the internal connection pool and database connections are currently not made available via jndi.
If you have set up confluence via the datasource option, I would suggest double checking the jndi name.
Aug 30, 2005
Bob Swift says:
For instance, if you configured your Confluence data source in server.xml (or el...For instance, if you configured your Confluence data source in server.xml (or elsewhere depending on your server and release)
Then the following works
{sql:jndi=ConfluenceDS} select count(distinct CONTENT.title) as "Confluence page count" from CONTENT {sql}Nov 01, 2005
Mingyi Liu says:
That still doesn't work for me though. I got this error: sql: org.apache.common...That still doesn't work for me though. I got this error:
sql: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory, cause: Io exception: The Network Adapter could not establish the connection
Do you know why Confluence is connected with our Oracle but the sql macro failed to? Thanks!
Nov 02, 2005
Daniel Ostermeier says:
Are you using the exact same resource being used by Confluence? If you are usin...Are you using the exact same resource being used by Confluence?
If you are using the same resources, then there should be no reason that Confluence has access and the SQLMacro does not.
Nov 03, 2005
Mingyi Liu says:
In my conf/server.xml, I added <Resource name="jdbc/confluence" auth="Contain...In my conf/server.xml, I added <Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource"/> and it's an oracle DS. Confluence was running fine. But using {sql:jndi=confluence} gave me the error I listed above.
Nov 03, 2005
Bob Swift says:
And is confluence the same resource being used by Confluence or did you add this...And is confluence the same resource being used by Confluence or did you add this only for the sql macro? I suggest you clip out all your data source specifications in server.xml and attach it here so we know exactly what it looks like.
Nov 03, 2005
Mingyi Liu says:
Here's the data source definition <Resource name="jdbc/confluence" auth="Co...Here's the data source definition
<Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/confluence"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>20</value> </parameter> <parameter> <name>maxIdle</name> <value>10</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <parameter> <name>username</name> <value>myname</value> </parameter> <parameter> <name>password</name> <value>mypass</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>url</name> <value>jdbc:oracle:thin:@myserver:1521:mydb</value> </parameter> <parameter> <name>connectionProperties</name> <value>SetBigStringTryClob=true</value> </parameter> </ResourceParams> </Context>I also searched and made sure under my confluence installation directory this file is the only one that has my oracle data source definitions. I've restarted server a couple times since moving to Oracle and Confluence was running perfectly on it.
Nov 03, 2005
Bob Swift says:
Nothing obviously wrong but I am not familar with Oracle. Perhaps Daniel c...Nothing obviously wrong but I am not familar with Oracle. Perhaps Daniel can help some more.
Nov 03, 2005
Mingyi Liu says:
OK. I was mostly looking to use your suggestion that retrieves some stats ...OK. I was mostly looking to use your suggestion that retrieves some stats about confluence usage, but I guess I'll just directly use a script to do it if I need to. One thing missing from your stats sqls is the page access stats, but I guess that's not stored in the DB, so we could only analyze server logs for those stats, right?
Nov 03, 2005
Bob Swift says:
See Tracking Plugin for page access tracking.See Tracking Plugin for page access tracking.
Nov 03, 2005
Daniel Ostermeier says:
All looks okay... Just to verify that Confluence is using this exact same datas...All looks okay...
Just to verify that Confluence is using this exact same datasource, can you please have a look at the CONFLUENCE_HOME/confluence.cfg.xml file, and tell me the value of the "hibernate.connection.datasource" property.
Nov 04, 2005
Mingyi Liu says:
hmm, that might be the problem. In the cfg.xml, there are lots of hibernat...hmm, that might be the problem. In the cfg.xml, there are lots of hibernate parameters, but none called hibernate.connection.datasource. Instead, there are hibernate.connection.username/password/url. So somehow my installation must be using direct connection then. Should I deleted these lines and replace with the datasource line?
Nov 06, 2005
Daniel Ostermeier says:
If you want confluence to work with a datasource, then you will need to change t...If you want confluence to work with a datasource, then you will need to change the cfg to contain the following (Oracle 9 example):
<property name="hibernate.connection.datasource">java:comp/env/jdbc/confluence</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.setup">true</property>
However, I would strongly recommend that you get the SQL macro working first. If the SQL macro is not able to use the datasource that you have configured within your app server, then Confluence will not be able to do so either.
Cheers,
-Daniel
Nov 06, 2005
prash b says:
Can I use this Macro to connect to MS Access DB?? If not, can you please direct ...Can I use this Macro to connect to MS Access DB?? If not, can you please direct me to some documentation that helps me do that....
thanks
Nov 06, 2005
David Loeng says:
You cannot currently setup Confluence against aMS Access database. Since this ma...You cannot currently setup Confluence against aMS Access database. Since this macro uses Confluence's database connection, you will not be able to use this macro with a MS Access db.
Cheers,
Dave
Nov 06, 2005
Bob Swift says:
Just to make sure there is no confusion, the macro can use any data source that ...Just to make sure there is no confusion, the macro can use any data source that is configured in the app server, not just the confluence data source. For instance, I have about 10 data sources configurated from multiple systems. That said, I don't know if MS Access can be configured as a data source.
Jan 18, 2006
Christian Barthelemy says:
Certainly a rookie's question but I cannot figure out how to configure the syste...Certainly a rookie's question but I cannot figure out how to configure the system to use a datasource connection:
Thanks for any help
Jan 18, 2006
Bob Swift says:
It does not matter how you installed Confluence. However, for any database that...It does not matter how you installed Confluence. However, for any database that you want to access, there needs to be a data source defined in your application server. So for instance, I have about 20 data sources defined accessing different databases. If you want access to the database Confluence uses, then, you will have to define a data source to that database and if you do that it is natural to also use that data source for Confluence. I will add some further data source configuration information on this page.
Jan 19, 2006
Christian Barthelemy says:
Thank you Bob, I am definitely interested to learn how to define a data source. ...Thank you Bob, I am definitely interested to learn how to define a data source.
I tried to google "mysql define data source": do you think that this URL provides relevant information?
Thank you
Jan 19, 2006
Bob Swift says:
Yes, the server.xml looks like a good example if you are using Tomcat. See also...Yes, the server.xml looks like a good example if you are using Tomcat. See also the attachment and paragraph I added to this page.
Jan 19, 2006
Tom Davies says:
Be aware that there are differences in the way datasources are defined between T...Be aware that there are differences in the way datasources are defined between Tomcat 4, 5.0 and 5.5.
Jan 19, 2006
Bob Swift says:
Yes, good warning. The server.xml is for the Tomcat that ships with the standal...Yes, good warning. The server.xml is for the Tomcat that ships with the standalone version of Confluence - Tomcat 4. I have examples for Tomcat 5.5 as well if someone needs that.
Jan 20, 2006
Christian Barthelemy says:
Thank you Bob and Tom, I have a standalone 2.1.1, so I added the lines in serve...Thank you Bob and Tom,
I have a standalone 2.1.1, so I added the lines in server.xml as indicated above.
After restarting my server I get the following error message when trying to sql the confluence database:
I am using the driver mysql-connector-java-3.0.17-ga-bin.jar as recommended.
Any idea what could be wrong?
Jan 20, 2006
Christian Barthelemy says:
(on)Ooops! It is working now! Sorry for the previous post: my driver wa...(on)Ooops!
It is working now! Sorry for the previous post: my driver wasn't located in the common/lib but in confluence\WEB-INF\lib.
Thank you again for your help
Mar 03, 2006
Kevin James says:
How do you configure multiple data sources in the servers.xml? Is that don...How do you configure multiple data sources in the servers.xml? Is that done by providing multiple <ResourceParam> elements? I'd like use this macro to access our JIRA database for displaying in Confluence pages. Is this possible?
Mar 03, 2006
Bob Swift says:
Yes, I have over 20 defined in one of my installations. You need the <Resou...Yes, I have over 20 defined in one of my installations. You need the
<Resource name=... and ResourceParams name=... as many times as you have different data sources.
Feb 19, 2006
Dan Hardiker says:
Have you set your MySQL server to operate on port 8080? The standard port for My...Have you set your MySQL server to operate on port 8080? The standard port for MySQL is 3306.
Change 8080 in the resource url to 3306 and give that a go.
Feb 19, 2006
Bob Swift says:
And you are missing the factory parameter compared to the example I use. <pa...And you are missing the factory parameter compared to the example I use.
Feb 19, 2006
Bob Swift says:
Ok, you will have to be more specific. What application server/version are you ...Ok, you will have to be more specific. What application server/version are you using? Or are you using standalone version of Confluence or Jira? If so, what version. Attach your server.xml.
Feb 19, 2006
Bob Swift says:
I get the same error if I try to use your method to configure the datasource: &...I get the same error if I try to use your method to configure the datasource:
I don't think this is valid format for this version of Tomcat. Use the format in the example server.xml and it should work:
<ResourceParams name="jdbc/TestDB"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> ... </ResourceParams>Feb 19, 2006
Bob Swift says:
Of course you need this part first: <Resource name="jdbc/TestDB" auth="Conta...Of course you need this part first:
Feb 20, 2006
Bob Swift says:
Jira 3.5 standalon Tomcat is a higher release level (5.5) and so excepts better ...Jira 3.5 standalon Tomcat is a higher release level (5.5) and so excepts better stuff. I wish Confluence and Jira supported the same level, it would make things less confusing.
Feb 20, 2006
Tom Davies says:
Confluence 2.2 will use Tomcat 5.5Confluence 2.2 will use Tomcat 5.5
Feb 20, 2006
Bob Swift says:
Apr 11, 2006
Derek Stevenson says:
Question regarding the use of parameters... I would like to use the SQL Macro o...Question regarding the use of parameters...
I would like to use the SQL Macro on one wiki page to generate links to another wiki page, and pass parameters to that second wiki page for expansion in a second SQL Macro. For example:
The fourth column would then link to another wiki page, where the employeeID is automagically expanded into one of the parameter fields in the sql macro definition of that page:
{sql:dataSource=TestDS|p1=(employeeID here)|showsql=true} select * from personnelrecord where employeeID = ? {sql}Which in turn would show something like
Sort of a summary and subsequent drill-down, if you will. I've accomplished the creation of a link in the first table by mangling the query to return wiki markup, but I haven't figured out the passing of parameters.
Is this remotely feasible or am I trying to use this in an unintended fashion? If this isn't possible, is there an alternative wiki plugin I could consider? I've briefly looked at the Jasper Report Macro and while it looks more complicated, perhaps that's the way to go.
Thanks,
Derek
Apr 11, 2006
Bob Swift says:
Derek, I have similar problems and I have another plugin in the works that will ...Derek, I have similar problems and I have another plugin in the works that will help with this type of problem. Unfortunately, it was not quite ready for the 2.3 release. Can you please capture your request and open a issue so it can be tracked and discussed. Thanks. The technique of using the query to create wiki markup for more complex things is valid - we use this in a number of places.
Apr 12, 2006
Bob Swift says:
Derek, you can experiment with the plugin attached to http://developer.atlassian...Derek, you can experiment with the plugin attached to http://developer.atlassian.com/jira/browse/SCRP-70. It is work in progress and you will need to figure it out from the documentation in the notation guide. I would appreciate any feedback and requirements.
Apr 12, 2006
Derek Stevenson says:
Per your request I opened a ticket to track the feature -- http://develo...Per your request I opened a ticket to track the feature -- http://developer.atlassian.com/jira/browse/SCRP-71
Don't know if this duplicates http://developer.atlassian.com/jira/browse/SCRP-70 or the two should be linked, I'll let you decide.
I'll work with our wiki admin to eval the run macro and will let you know when I've had a chance to look at it.
Apr 12, 2006
Derek Stevenson says:
Is the notation guide in the jar itself? runmacro-help.vm perhaps?Is the notation guide in the jar itself? runmacro-help.vm perhaps?
Apr 12, 2006
Bob Swift says:
Derek, thanks for the issue. Yes, wanted both issues as your issue captures the...Derek, thanks for the issue. Yes, wanted both issues as your issue captures the requirement you have. The notation guide can be consulted once the macro is installed (I saw your other problem). Yes, the source HTML is in the jar, but much better to look at as part of the Advanced section of the notation guide. I see from your other note, you have got the idea. If you are not familar with the notation guide, edit any page on your site and on the bottom right in the help area you will see a link to Confluence notation guide,
Apr 17, 2006
Jerome Jr Villalon says:
Hi, Could someone please help me complete the installation of this plugin....Hi,
Could someone please help me complete the installation of this plugin. So far I have uploaded the sql macro onto the server via the plugin uploader and placed the JDBC Sybase driver (jConnect) in the /common/lib/ directory. I am currently trying to edit the server.xml file but am having trouble what values to change. We are using a Tomcat server, and plan to use a Sybase Datasource.
I've found documentation on Configuring a MySQL Datasource in Tomcat, is there an equivalent documentation for a Sybase Datasource in Tomcat?
In particular I am not sure of the values that are highlighted in red text.
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://-------:8808/test?autoReconnect=true</value>
</parameter>
Also, is there any additional information I should know?
Apr 17, 2006
Jerome Jr Villalon says:
Sorry, forgot to highlight another part of the script. <parameter> <n...Sorry, forgot to highlight another part of the script.
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://-------:8808/test?autoReconnect=true</value>
</parameter>
Apr 17, 2006
Bob Swift says:
Maybe http://www.mail-archive.com/commons-user@jakarta.apache.org/msg14957.html ...Maybe http://www.mail-archive.com/commons-user@jakarta.apache.org/msg14957.html will help? Otherwise try google tomcat sybase datasource.
Apr 20, 2006
Jerome Jr Villalon says:
Thanks got it working! That message was useful. Heres what I did, it might help ...Thanks got it working! That message was useful. Heres what I did, it might help others.
<name>driverClassName</name>
<value>com.sybase.jdbc3.jdbc.SybDriver</value>
...
<name>url</name>
<value>jdbc:sybase:Tds:servername:port?autoReconnect=true</value>
Apr 25, 2006
Bob Swift says:
Open an issue including the html that was generated for the page around where it...Open an issue including the html that was generated for the page around where it was messed up. Thanks.
May 05, 2006
Jeff Hatfield says:
Has anyone figured out a way to prompt a user for the parameter to feed to the S...Has anyone figured out a way to prompt a user for the parameter to feed to the SQL macro?
May 05, 2006
Bob Swift says:
Yes, there are some early efforts in this area. See the earlier posts.Yes, there are some early efforts in this area. See the earlier posts.
May 20, 2006
Rainer Bugow says:
The macro seems not to work under 2.2.1a (mySQL). After upgrading from 2.1.4 wit...The macro seems not to work under 2.2.1a (mySQL). After upgrading from 2.1.4 with an unchanged server.xml (Logger removed) I get:
sql: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
Are there any hints to get it right ?
May 20, 2006
Bob Swift says:
I suspect you are using the standalone version of Confluence? If so, 2.2.x uses...I suspect you are using the standalone version of Confluence? If so, 2.2.x uses Tomcat 5.5 which has changes in data source configuration from previous versions. Check your data source configuration. Here is an example:
<Resource name="jdbc/ConfluenceDS" auth="Container" type="javax.sql.DataSource" username="confluence" password="xxxxxxx" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://myserver:3306/mydatabase?autoReconnect=true" />May 21, 2006
Rainer Bugow says:
Thanks, got it working and attached my server.xml.Thanks, got it working and attached my server.xml.
Jun 08, 2006
patrice saint-louis says:
If I have a query (in Oracle) such as the where clause is like below: where &nb...If I have a query (in Oracle) such as the where clause is like below:
where log_timestamp > to_date('5/23/2006', 'mm/dd/yyyy')
I tried to replace the Date ('5/23/2006') with a parameter $fromdate
so that it looks like where log_timestamp > to_date($fromdate, 'mm/dd/yyyy')
It doesn't seem to work. I get the following error:
====
sql: java.sql.SQLException: ORA-00911: invalid character
select exception_classname, exception_message, logger_name, message_level_name, user_session_id, log_timestamp, user_agent
from liu_app_log partition (LIU_APP_LOG_20060529)
where
log_timestamp > to_date($fromDate, 'mmddyyyy') and message_level_name = 'ERROR'
order by
log_timestamp DESC
=====
Jun 08, 2006
Derek Stevenson says:
Make sure whatever you're providingin $fromDate matches the date mask you're p...Hope one or both of these helps.
Jun 24, 2006
Vaishnavi says:
A great macro! However, is there a way to get the output as comma separated ...A great macro! However, is there a way to get the output as comma separated values or any delimiter for that matter. Was experimenting with creation of a user macro to use the data returned from this but manipulation of the data from tables seems cumbersome.
Thanks in advance!
Jun 24, 2006
Bob Swift says:
It could be changed to support that I suppose, but I would like to understand ho...It could be changed to support that I suppose, but I would like to understand how it would be used. Write up an issue with some details. You can specify table=false and just get the raw data that could included constants (like commas) separating fields.
Jun 26, 2006
Vaishnavi says:
I am attempting to create [sparklines|http://www.edwardtufte.com/bboard/q-a...I am attempting to create [sparklines|http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR&topic_id=1] using an user macro. For this I need to use the data returned from the SQL query. I tried using table=false but the fields are continuous with nothing to separate them. Is there anything else I need to specify. If the functionality does not exist / cannot be achieved in anyway, I shall raise an issue.
Thanks again!
Jun 26, 2006
Jeff Hatfield says:
I'm not sure if this helps, but we do a lot of links from SQL queries and found ...I'm not sure if this helps, but we do a lot of links from SQL queries and found that it is easier to output in HTML format and code the links as HTML. Something like this.
Jun 26, 2006
Bob Swift says:
You can separate the fileds with whatever constants you want using silimar SQL t...You can separate the fileds with whatever constants you want using silimar SQL techniques like in Jeff's comment. If you want more detailed control, you can use a beanshell (java) script that runs SQL and then formats the output - but this is a lot more programming. See the Beanshell Macro.
Jun 27, 2006
Vaishnavi says:
Thanks. I did use SQL techniques as suggested by Jeff to get the desired result....Thanks. I did use SQL techniques as suggested by Jeff to get the desired result. Although modifying it for any changes seems very cumbersome. Shall try and experiment with beanshell too. Would there be any SQL example in beanshell?
Thanks again!!
Nov 14, 2006
Andrew Whyte says:
Curious if there is any reason behind why when using the SQL macro within a user...Curious if there is any reason behind why when using the SQL macro within a user marco to produce an internal link (as in, within confluence) always shows in error in the table. Am I doing something wrong?
I've got a basic query that returns a field for each row using MySQL's concat function to build a wiki markup style link, this works great if the sql macro is used in a normal page context. But when I create a user macro that uses the sql macro within it, the rendering for some reason get's messed up.
This is my user macro, I use this because you cannot use the MAX() function without grouping in a MySQL select statement, and I'm not using new enough MySQL to allow nested selects, so the only way to get SQL run in a reliable serial method is to create the requests into a user macro as they are performed in turn. i.e. run a query to store a variable in mysql session, then use that in the next query. It works well, I just can't get around the linking issue.
#set($globalHelper=$action.getGlobalHelper()) #set( $lastRun = "{sql:dataSource=MyDB|table=false}SELECT @MAXrunDate:= MAX(runDate) FROM tbl_Status{sql}" ) #set($renderedContent=$globalHelper.renderConfluenceMacro($lastRun)) #set( $query = "{sql:dataSource=MyDB|showSql=$paramshowSql|table=true|output=wiki}SELECT host Hostname, CONCAT('[Status+-+',host,']') Details FROM tbl_Status WHERE tbl_Stauts.runDate=@MAXrunDate{sql}" ) #set ($rContent=$globalHelper.renderConfluenceMacro($query)) ${rContent}The hope is to obviously have these link to pages within confluence. Doing it this way they error (the link shows in RED), however if I do anything else, such as make the link a full URL e.g.
they render just fine.
I'm unsure if this is the User Macro getting in the way, or something in the SQL macro not coming through correctly. Anyone have any thoughts on this?
Nov 29, 2006
Mark Derricutt says:
We've just started to make use of the SQL and Charting macros and finding them b...We've just started to make use of the SQL and Charting macros and finding them both excellent additions to confluence, however we're finding that some of the queries we're running often take some time to run and was wondering if there's anyway of adding cached resultset support to the macro.
For example,
select * from ......
This would greatly speed up the display of subsequent page views.
Another idea I had was, in addition to adhoc queries in the body of the macro, or as an attachment, the use of 'named queries' which could be defined in some form of plugin configuration area, and are executed/refreshed every so often, so that the sql macro could just return pre-cached results which would make things even faster.
Thanks for the great macros...
Nov 29, 2006
Bob Swift says:
Mark, please look at the Cache Macro and see if that meets some of your needs. ...Mark, please look at the Cache Macro and see if that meets some of your needs. Some significant upgrades are in progress for these macros, so please create new ideas and requests in the issue tracker for the appropriate macro (see the link in the header of the macro page). Specifically, I am interested in your ideas regarding named queries. Perhaps it is a similar concept to a Chart enhancement this is being implemented now: Chart plugin - saving chart image as attachment
Nov 30, 2006
apolo says:
can I process result of sql query by using beanshell macro?can I process result of sql query by using beanshell macro?
Nov 30, 2006
Bob Swift says:
Yes, you can write a beanshell macro that does its own SQL and processes the res...Yes, you can write a beanshell macro that does its own SQL and processes the result set in whatever way you like. We do this occasionally when we need more than a table output. An example is: Script - beanshell sql example
Dec 14, 2006
Jeff Guthrie says:
Can someone add a sample of connecting to a normal SQL database above? (where t...Can someone add a sample of connecting to a normal SQL database above? (where the mysql and oracle datasources are documented) Thanks!
Dec 14, 2006
Bob Swift says:
Jeff, hopefully someone else can post a simple example. In the meantime, you ca...Jeff, hopefully someone else can post a simple example. In the meantime, you can look at Database Setup for SQL Server and specifically point 3 and the referenced faq to get the right URL parameters.
Jan 08, 2007
Jeff Guthrie says:
Thanks for that Bob! I was also curious, how often does the query fire? If we ...Thanks for that Bob! I was also curious, how often does the query fire? If we have a page that is heavily used, that queries a database, will it negatively impact performance of the db it is querying? For now we are just querying the 10G database Conf is installed on to get usage stats but I was thinking that we could set up dashboards to query other application's databases for specific users. I don't want to negatively impact the db's performance though. Are the results cached?
Jan 08, 2007
Bob Swift says:
The results are not cached by the sql macro. However, you can use the Cache Mac...The results are not cached by the sql macro. However, you can use the Cache Macro to cache the results for many macros including the sql macro.
Jan 09, 2007
Jeff Guthrie says:
Oh ok thanks! Have you experienced any negative side affects from this macro? ...Oh ok thanks! Have you experienced any negative side affects from this macro? Like another apps db getting hit too much and suffering in performance?
Can you restrict its use to a particular group?
Jan 09, 2007
Bob Swift says:
No, we don't experience any problems that way. Definitely use the Cache Plugi...Jul 11, 2007
Jeff Guthrie says:
It appears that that plugin isnt supported anymore and we are on 2.3.3, moving t...It appears that that plugin isnt supported anymore and we are on 2.3.3, moving to 2.5.4 here soon. Does that mean there isnt a way to restrict access (who can use it) to this plugin?
Apr 25, 2008
Bob Swift says:
That is an old post. This plugin is covered by Macro Security Plugin.That is an old post. This plugin is covered by Macro Security Plugin.
Aug 01, 2007
Jeff Guthrie says:
Sweet thanks! So the macros listed on the Macro security page already have that...Sweet thanks! So the macros listed on the Macro security page already have that security built in, you just need to add the macro-security.properties file to your Conf install? Pretty slick...
Jan 09, 2007
Bob Swift says:
Renamed to Cache Plugin. Hmmm... I thought Confluence was suppose to do renames...Renamed to Cache Plugin. Hmmm... I thought Confluence was suppose to do renames even in comments?
Feb 10, 2008
Joseph says:
Hello, has anyone posted examples of using MS SQL Server with this plug-in? In p...Hello, has anyone posted examples of using MS SQL Server with this plug-in? In particular, I am trying to connect to a remote (non Confluence) MS SQL Server database to retrieve results from our Sales Portal.
thanks in advance.
Feb 10, 2008
Bob Swift says:
Follow the instructions I mentioned a few comments up. Specifically, using the ...Follow the instructions I mentioned a few comments up. Specifically, using the jtds jdbc driver. Install the jtds driver in ...\common\lib. Here is a datasource configuration example:
<Resource name="jdbc/sqlserverDS" auth="Container" type="javax.sql.DataSource" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://myserver:1433/mydatabase" username="xxxxxxx" password="xxxxxx" maxActive="20" maxIdle="10" maxWait="-1"/>Jan 23, 2007
Darren Bell says:
Has anyone managed to get this to work in JBoss? We have confluence v2.3 runnin...Has anyone managed to get this to work in JBoss?
We have confluence v2.3 running just fine in JBoss. We have set up our confluence datasource as follows:
<?xml version="1.0" encoding="UTF-8"?> <!-- $Id$ --> <!-- Datasource config for Pics --> <datasources> <local-tx-datasource> <jndi-name>ConfluenceDS</jndi-name> <connection-url>jdbc:db2://auk.dolby.net:50000/CONF</connection-url> <driver-class>com.ibm.db2.jcc.DB2Driver</driver-class> <user-name>conf</user-name> <password>wel0veconf</password> <!-- sql to call when connection is created <new-connection-sql>some arbitrary sql</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> --> </local-tx-datasource> </datasources>Every time we try and use the sql macro, the datasource cannot be found. I read above that this macro adds java:comp/env to the datasource name. Why is this.
Any help would be appreciated.
Jan 23, 2007
Andy Brook says:
In the previous example, the solution is to prefix the jndi-name 'ConfluenceDS' ...In the previous example, the solution is to prefix the jndi-name 'ConfluenceDS' with java: so the sql-plugin becomes:
It works fine in jboss405/confluence 2.3:-
select * from OS_USER
Jan 24, 2007
Darren Bell says:
Yup, that fixed it. Cheers.Yup, that fixed it. Cheers.
Jan 24, 2007
Sam Peascod says:
Just upgraded our installation from 2.1.5 to 2.3.1. Installed the latest v...Just upgraded our installation from 2.1.5 to 2.3.1. Installed the latest version of SQL Plugin through the repository. I'm getting this error message:
Any ideas?
Jan 24, 2007
Sam Peascod says:
sql: javax.naming.NamingException: Could not create resource factory, ClassNotF...^^ That's the error message. Was suppressed from my last entry for some reason.
Jan 24, 2007
Bob Swift says:
Have not seen that and unfortunately my test environment is down. At least a day...Have not seen that and unfortunately my test environment is down. At least a day before I can have a more detailed look. Seems like it could be a missing component jar. In the meantime, you could send any related log information or, if nothing, then add log4j.logger.org.swift.confluence.sql=DEBUG to the .../WEB-INF/classes/log4j.properties
Open an issue and attach the information.
Jan 25, 2007
Sam Peascod says:
Fixed it. Turns out there was some throwover to "Atlassin Confluence Plugi...Fixed it. Turns out there was some throwover to "Atlassin Confluence Plugins" by Danny Chan which also had a SQL macro. Uninstalling this through plugins (rather than the repository) fixed the problem.
Sep 18, 2007
Kirk Mook says:
Connecting to Oracle dbase as well, and also got the resource factory error.&nbs...Connecting to Oracle dbase as well, and also got the resource factory error. I didn't understand your fix though about the reference to, "some throwover to Atlassin Confluence Plugins by Danny Chan." What plugin name exactly must be uninstalled?
- kirk
Sep 18, 2007
Bob Swift says:
Kirk, basically it means that you should make sure your installation doesn't hav...Kirk, basically it means that you should make sure your installation doesn't have a old version of the plugin containing an sql macro. For instance, an old version of Scripting and External Content Macros. Check your repository list and .../WEB-INF/lib
Jan 29, 2007
Andrew Whyte says:
This is sort of a repeat question, but I couldn't see it clearly answered, or de...This is sort of a repeat question, but I couldn't see it clearly answered, or defined above. So in an effort to get more info I'll ask again.
It's currently possible to make use of the SQL macro within your own user macro, but simply using the content redering function, such as:
#set( $query = "{sql:dataSource=MyDB|showSql=false|table=true|output=wiki}SELECT * FROM tbl_Status WHERE tbl_Stauts.runDate=NOW(){sql}" ) #set ($rContent=$globalHelper.renderConfluenceMacro($query))This lets you get at data in a table, but I'd like to know if the SQL macro provides a better method similar to the $content, $action, $req devices in the user macro space.
e.g. I'd love to be able to do something like this:
#set($user=$action.remoteUser) #set($dbh = $sql.setConnector("MyDBConn")) #set($DoB = $dbh.executeQuery("select date_of_birth from tbl_Users where userid='$user.name'")) <div> Your Date of Birth is: $DoB </div>This would really allow the power of the sql interface within confluence to be realised without going to the effort of a full blown macro. Something which is quite daunting for non-programmers I feel.
So, is this already possible and I just need to learn the syntax? Or is it something that would be possible to add?
Cheers.
Feb 05, 2007
Frank Stiller says:
I have a odbc Datasource, with MS Access. Confluence succeeds in connecting to t...I have a odbc Datasource, with MS Access. Confluence succeeds in connecting to this datasource, but never shows something in the resultset (there is no failure, just an empty resultset, ok this is a failure
).
I made a System-DSN which i registered with my MS Access-DB, the ressource-name i use in the server.xml:
First example:
The following is the same result with the RmiJdbs-Connector from ObjectWeb
Second example:
When i use the SQL-Macro it gives me an error (like Table not found if i use a none existent Table, which i would say is a good indicator that the connection is there) if i make a wrong SQL-Query, but gaves me a empty-resultset when i make a select statement on a existing table like:
{sql:dataSource=myDB}select * from tab_test{sql}Feb 05, 2007
Frank Stiller says:
Some more info on this. It worked good with Confluence 2.1.4, but seems broken s...Some more info on this. It worked good with Confluence 2.1.4, but seems broken since we moved to 2.2.8.
I made all tests on Confluence 2.2.8 (live) and on my testsystem 2.3 and 2.3.1.
I used the SQL-Plugin 3.0.1 and 3.1
All other connections seem to work (Oracle, SQL Server, MySQL, just odbc seems to have problems)
Feb 05, 2007
Bob Swift says:
Frank, please open an issue and we can have a further discussion there. Include...Frank, please open an issue and we can have a further discussion there. Include any related information from the logs. What sql-plugin version worked ok for odbc on 2.1.4?
Feb 06, 2007
Frank Stiller says:
Hy Bob, i created the issue. The upgrade from 2.1.4 was quite some time ago, we ...Hy Bob, i created the issue. The upgrade from 2.1.4 was quite some time ago, we didnt use that feature since then, or at least we tried to solve the problem ourselves
May 11, 2009
Oliver Hüppe says:
Hey Frank. any updates on your problem. I run in this problems with version 3.5...Hey Frank.
any updates on your problem. I run in this problems with version 3.5 also.
oliver
May 11, 2009
Frank Stiller says:
Hy Oliver, the Problem did not persist very long, was resolved with Plugin Vers...Hy Oliver,
the Problem did not persist very long, was resolved with Plugin Version 3.2.2, see http://developer.atlassian.com/jira/browse/SQL-16.
I just checked it, MsAccess is rendering fine with Confluence 2.10.1 and SQL Plugin Version 3.5.0 in my Instance.#
What exactly is your Problem?
--Frank
May 11, 2009
Oliver Hüppe says:
Hey Frank, your name sounds german, if so it's easier for me to explain in germ...Hey Frank,
your name sounds german, if so it's easier for me to explain in german.
Oliver
May 11, 2009
Frank Stiller says:
Die Seite lädt recht langsam, Du kannst auch gerne ein Issue bauen, oder auch hi...Die Seite lädt recht langsam, Du kannst auch gerne ein Issue bauen, oder auch hier weiter antworten. An welcher Stelle mag denn Dein Confluence nicht gehorchen?
May 11, 2009
Oliver Hüppe says:
Das ist ja praktisch. Das Problem äußert sich so: Habe eine Access97 DB und hab...Das ist ja praktisch. Das Problem äußert sich so:
Habe eine Access97 DB und habe eine Datasource in der server.xml auf eine DSN erstell. Die DSN zeigt auf die Datenbank, welche auch lokal auf dem confluence-server liegt.
Wenn ich jetzt das SQL-Plugin benutze erhalte ich die Meldung: sql-query: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Fehler in der Funktionsreihenfolge.
select * from kundenstammdaten
Auszug aus der server.xml
<Resource name="jdbc/adressdb" auth="Container" type="javax.sql.DataSource" username="test" password="test" driverClassName="sun.jdbc.odbc.JdbcOdbcDriver"
url="jdbc:odbc:adressdb"/>
Habe jetzt schon einiges ausprobiert, aber ich erhalte immer diese Fehlermeldung, welche wohl von ODBC kommt.
Hinweise wären toll.
Gruß
Oliver
May 11, 2009
Frank Stiller says:
1) Was für eine Art DSN hast Du denn erstellt? Bei mir läuft es mit einer System...1) Was für eine Art DSN hast Du denn erstellt?
from kundenstammdaten oder select 1 ?
Bei mir läuft es mit einer System DSN, ich hoffe die heisst bei Dir adressdb
2) lass mal username und password leer, ich weiss nicht ob die überhaupt abgefragt werden, falls man an den Benutzername/PW Einstellungen nicht herumspielt sind diese üblicherweise ja nicht gesetzt.
3) wenn ich nach dem Fehler im Netz suche kann es auch an nicht unterstützen Feldtypen liegen, funktioniert z.B.: select count
grüße
Frank
May 11, 2009
Oliver Hüppe says:
Hallo Frank, Oh Mann, manchmal kann man sich wirklich blöde anstellen. Ich habe...Hallo Frank,
Oh Mann, manchmal kann man sich wirklich blöde anstellen. Ich habe es jetzt mal mit dem
-macro probiert und das funktioniert tadellos. Zuvor hatte ich immer das sql-query macro probiert und damit erhalte ich die Fehlermeldung.Damit kann ich leben
Trotzdem merci für die Mühe
Gruß
Oliver
Feb 16, 2007
Richard C. Tallini says:
I am also trying to use this in 2.3.1 and I would love to see this functionality...I am also trying to use this in 2.3.1 and I would love to see this functionality added
I hope we can get this issue resolved soon!
Feb 16, 2007
Bob Swift says:
I assume you are referring to the odbc connection? If so, please log any additi...I assume you are referring to the odbc connection? If so, please log any additional information with the issue: SQL-12. Since I don't have that specific environment, I don't know when I will be able to reproduce the problem.
Mar 26, 2007
Jeff Guthrie says:
Would it be possible for the space admin to go through and add some of the knowl...Would it be possible for the space admin to go through and add some of the knowledge in these comments to the content of the page and organize it a bit? There is lots of good stuff in here but it takes ages to read through all the comments. Just a thought...
Apr 08, 2007
Bob Swift says:
Good idea! I don't have time right now to do that, but perhaps someone else can ...Good idea! I don't have time right now to do that, but perhaps someone else can get that started.
Apr 08, 2007
Jeongnim Kim says:
Can someone post an example showing how to change the column labels with output=...Can someone post an example showing how to change the column labels with output=wiki?
Apr 08, 2007
Bob Swift says:
If you mean you want to replace the column name with a more user friendly name, ...If you mean you want to replace the column name with a more user friendly name, then this can be done with your sql.
{sql:datasource=TestDS} select a1 as "Label for a1", a2 as "Label for a2" from test01 {sql}Some databases (like DB2) support defining column labels in the database. In that case, use parameter columnLabel=true on the sql macro.
Apr 13, 2007
Shon Stephens says:
Is it possible to create a table where the 1st sql statement provides the ...Is it possible to create a table where the 1st sql statement provides the values for the rows in the first column, and and those values become a variable for the sql statement that produces the results for the 2nd column?
Thanks,
Shon
May 04, 2007
Vipan Bahl says:
Hi As part of my testing I ran simple select command to return huge set of row ...Hi
As part of my testing I ran simple select command to return huge set of row in access of 120000 , it did not work once it came back with nothing and next time it crashed my confluence,
Having browsed through I came across maxRows property with I set as maxRows="25"( can be anything ) in the data source configuration and re-ran the query but no luck
Does anyone have any idea as to why this is not working or otherwise.
Also
do we any examples on how to use this option - #filename - Data is read from the file located in confluence home directory/script/filename. Subdirectories can be specified
May 04, 2007
Bob Swift says:
There is not a maxRows parameter but that would be a good suggestions. Right up...There is not a maxRows parameter but that would be a good suggestions. Right up an issue and it can be added.
Jan 17, 2008
Leon Collins says:
window.SyntaxHighlighter.config.clipboardSwf = '/s/1724/13/2/_/download/resou...{sql:dataSource=helpdesk\|output=wiki\|script=#CInas.sql} {sql}CInas.sql is in my confluence_data/script directory.
May 22, 2007
Vipan Bahl says:
Hi Bob What do i need to do to have this put in as a issueHi Bob
What do i need to do to have this put in as a issue
May 22, 2007
Bob Swift says:
See issue tracking link at top of page.See issue tracking link at top of page.
Jun 15, 2007
marlo hutch says:
I am trying to create a link to one of the columns in the resultset. But, it's ...I am trying to create a link to one of the columns in the resultset. But, it's returning an error. The column is mixed character. Any ideas?
The error is: sql-query: java.sql.SQLException: ORA-01722: invalid number
Part of the query is this...
select
techdate
, techname
, '<a href="www.companya.com&field=' + to_char(incident_number) + '">' + to_char(incident_number) + '</a>'
,...
When you look at the code again the query looks like this (the links are empty)...
select
techdate
, techname
, '' + to_char(incident_number) + ''
,...
Thanks for your help
Jul 10, 2007
marlo hutch says:
Can someone answer my question about adding links as part of SQL statement (macr...Can someone answer my question about adding links as part of SQL statement (macro)? I am using Version: 2.3.3 Build:#645. I have researched and learned that adding links are very possible and doable. But, I have been unsuccessful in finding any examples.
Thanks for your help in advance!
Jul 10, 2007
Bob Swift says:
First, make sure your sql works correctly in your favorite query tool. If you g...First, make sure your sql works correctly in your favorite query tool. If you get an error, simplify the query to isolate the error until you get it resolved. Regarding the Confluence part of this, I suggest you use the macro parameter output=wiki and redo your link to be Confluence wiki markup - something like
The reason for this is that the html stuff you have in your example will just be interpreted as text by Confluence.
May 16, 2008
Ryan says:
Could you please complete this example, with a complete code snippet that shows ...Could you please complete this example, with a complete code snippet that shows a column name being inserted into a wiki link as part of a query? The .... leave much to be desired for someone who is not familiar with the wiki markup and is looking for good examples. For example, If I have a query with one column that I want to make into a link and another column where the data contains carriage returns, that destroy the formatting of the table, how is this coded?
Jul 10, 2007
Mark Derricutt says:
Is it possible to add a CSV output type? One of the guys in the office was...Is it possible to add a CSV output type? One of the guys in the office was asking about having support for that - not entirely sure what he was wanting it for thou..
Jul 10, 2007
Bob Swift says:
It is unclear what the request is. Open an improvement request issue and try to...It is unclear what the request is. Open an improvement request issue and try to explain what is wanted.
Jul 10, 2007
Mark Derricutt says:
Entered as SQL-22. The user in question indicated it wasn't a problem if the ma...Entered as SQL-22. The user in question indicated it wasn't a problem if the macro couldn't do it - but I thought I may as well report it as others may also find it handy.
Jul 25, 2007
Andy Brook says:
Hi Bob, I'm now looking at SQL scriptswhich I had running fine, but insecurely,...Hi Bob,
I'm now looking at SQL scriptswhich I had running fine, but insecurely, Im trying to enable macro security but get a:
after setting edit permissions on the page to be the group identified in the macro-security.properties file in confluence folder - and restarted appserver. Is macro security working for SQL commands? is there an incompatibility with SQL and Script plugins? Did I miss something?
(confluence =2.5.2, SQL plugin = 3.2.2, script plugin = 3.1.1-NG)
TTFN, Andy.
Jul 25, 2007
Bob Swift says:
Andy, you should have the SQL 3.3 version for Confluence 2.5.2+. I don't unders...Andy, you should have the SQL 3.3 version for Confluence 2.5.2+. I don't understand why it is not showing up here. It should be coming out of the repository - might be some repository problems. At least, you can get the jar out of SVN.
Aug 02, 2007
Barry Caruth says:
It appears the wrapping {table-plus} tags around this plugin with wiki output do...It appears the wrapping {table-plus} tags around this plugin with wiki output doesn't create a table-plus table. Is that a feature or a fault?
Aug 02, 2007
Bob Swift says:
There is no need to wrap this plugin with table-plus since it natively supports ...There is no need to wrap this plugin with table-plus since it natively supports Common table capabilities.
Aug 02, 2007
Barry Caruth says:
Thanks Bob - that's what I thought but with: window.SyntaxHighlighter.config...Thanks Bob - that's what I thought but with:
{sql:dataSource=blah|output=wiki|script=^attachment.sql|enableSorting=true}{sql}...the table generated doesn't allow me to sort by different columns when I click on the headings.
Aug 02, 2007
Bob Swift says:
Write up an issue with more details on Confluence level, plugin level, browser u...Write up an issue with more details on Confluence level, plugin level, browser used. Sorting is done via javascript, so look for any browser errors or restrictions.
Aug 17, 2007
Andrey Dmitriev says:
Please update documentation on oracle, should say window.SyntaxHighlighter.co...Please update documentation on oracle, should say
not
Also, we had to add
I have no idea what it does though, our tomcat 'expert' added it ,but w/o it the connection wouldn't work to Oracle
Aug 31, 2007
Matt Keeneth says:
Is it possiable to assign the result of a query to a velocity variables for use ...Is it possiable to assign the result of a query to a velocity variables for use in a page or user macro?
SQL like this:
Variables:
$column1Name, $column1row1value, etc...
Which would give me access the number of users watching a page.
Sep 05, 2007
Scott Golby says:
Has anyone got the Instructions above to work using Tomcat 5.0.19 with...Has anyone got the Instructions above to work using Tomcat 5.0.19 with Confluence 2.5.3 and MySQL 4.1 ?
I spent nearly 2 hours trying to make it work, getting 'null' errors like mentioned in previous postings. I tried adding factory="org.apache.commons.dbcp.BasicDataSourceFactory" which isn't mentioned in the instructions, but in one of the follow-ups to the first 'null'. Still didn't work.
In desperation I copied the server.xml file http://confluence.atlassian.com/download/attachments/128258/server.xml?version=1 and copy & pasted my config into that different layout & it worked.
Here is my config in the hope of saving other people the frustration I went through
Sep 05, 2007
Christopher Owen says:
The examples above are using the Tomcat 5.5 resource specification scheme. They ...The examples above are using the Tomcat 5.5 resource specification scheme. They changed from an element based spec to an attribute based one between 5.0 and 5.5. It's been the source of much confusion for many users (myself included)
Jan 14, 2008
Paul Csapo says:
Dear Bob, we have tried this and have been able to sucessfully get it to work al...Dear Bob, we have tried this and have been able to sucessfully get it to work alongside the Chart plugin too.
Thanks for developing it.
I was wondering if there is a list of each SQL action that your plugin supports. Eg, does it support INSERT statements, or only read-only actions?
kind regards,
Paul
(edit: thanks for the info Bob)
Sep 14, 2007
Bob Swift says:
sql macro supports inserts and most other SQL. sqlquery macro only supports rea...sql macro supports inserts and most other SQL. sqlquery macro only supports read-only. Sorry, I need to document more examples.
Sep 18, 2007
Kirk Mook says:
Now have Oracle dbase and this is not working. Message displaying: window.Sy...Now have Oracle dbase and this is not working. Message displaying:
I'm using the default settings for Oracle setup as outlined, with the addition of the datasourcefactory line. It has failed with the same message both with and without the datasourcefactory line.
Here's my code from server.xml:
My C:\confluence\confluence-2.5.4-std\confluence\WEB-INF\web.xml:
<resource-ref> <description>Connection Pool</description> <res-ref-name>jdbc/confluencedb</res-ref-name> <res-type>javax.sql.Datasource</res-type> <res-auth>Container</res-auth> </resource-ref> </web-app>I'm using the same code for attempting to display content as I have referenced in my previous message when I was having trouble with MySQL.
Another user had the same error I had, but I don't understand the fix he did, which seemed rather vague.
Thanks,
Kirk
Sep 22, 2007
Todd Katz says:
After succeeding with this nice plug-in using mySQL, I tried this on our company...After succeeding with this nice plug-in using mySQL, I tried this on our company equipment which uses SQLServer.
I also am getting the javax.naming.NamingException exception ...
It seems that one common problem relates to getting the name of the database right in all the right places. I think that that name needs to appear in identical form in:
Can one also assume that it is correct to use the Runtime Information (RI) from Confluence verbatim. In such case:
Also the <resource-ref> in web.xml should have a <res-type> that exactly matches the database dialect in the Confluence Runtime Information.
If the above is not right, this may be a source of confusion.
Adding settings for factory and connectionProperties in the server.xml resource seems to only be needed for Oracle. Is that right?
Finally, it's a little unclear what the database name should be in formulations such as:
jdbc:jtds:sqlserver://Mydb:1433/myCatalog (actually I don't know whether the last is a catalog or a schema).
In such a case should the name in Resource in server.xml be:
name="jdbc/myCatalog" (with a matching setting in web.xml, of course) ?
Finally I noticed that someone declared success by dropping the "jdbc:" at the head of the url string in server.xml - when would you do that?
If I ever figure this out, I'll try to put a table with the above info (correct, of course) in this thread.
Best,
Todd
Apr 17, 2009
Bryan Maupin says:
I had this exact same problem. We're running Confluence 2.10.2 with Tomcat 5.5 ...I had this exact same problem. We're running Confluence 2.10.2 with Tomcat 5.5 on RHEL 5.3 connecting to an Oracle 9.2 data source. This is the error we got:
Our solution:
I went to the Tomcat website and downloaded a binary distribution of Tomcat 5.5 (go to http://tomcat.apache.org/, on the left under "Download" click "Tomcat 5.5," then scroll down under "Binary Distributions," and download one of the files under "Core.")
I unzipped that file, which for me created the apache-tomcat-5.5.27 folder. In that folder, under common/libs, I needed the file "naming-factory-dbcp.jar." I put that file on my server in /var/lib/tomcat5/common/lib, restarted Tomcat, and now it works just fine.
Oct 17, 2007
Steindor says:
I'm getting a sql: Unexpected program error: java.sql.SQLException: Col...I'm getting a
sql: Unexpected program error: java.sql.SQLException: Column '' not found.
whenever I use an aggregate or scalar function on a column (e.g. count, sum, length), like
select count(id) from my_table
I'm using MySQL and have tried combinations of fully qualified names and aliases with no effect. Any ideas what could be going on?
Oct 17, 2007
Bob Swift says:
This works as expected normally. Create an issue with detail and logs.This works as expected normally. Create an issue with detail and logs.
Oct 20, 2007
Pramod Kumar says:
I too found this problem recuring in my installation. But this problem appears t...I too found this problem recuring in my installation. But this problem appears to be specific to version 2.6 of the confluence I think.
I have 2.5.4 version which does not have this problem
Oct 23, 2007
Imtiaz B Syed says:
Sql macro is not working properly in convluence v2.6.0 which is under JBoss App ...Sql macro is not working properly in convluence v2.6.0 which is under JBoss App server where as the same is working with confluence v2.5.4 / v2.5.6.
Where as the version of confluence v2.6.0 under Tomcat 5.5 is working perfectly without any issues. The only problem is with v2.6.0 under JBoss.
Example query:
{sql:datasource=ConfluenceDS} SELECT SPACENAME, 'syed' as NAME FROM SPACES; {sql}\\And the exception it throws is as follow:
sql: Unexpected program error: java.sql.SQLException: Column '' not found.
SELECT SPACENAME, 'syed' as NAME FROM SPACES;
Oct 26, 2007
Quent Chalmers says:
I'm having a problem with a proprietary JDBC driver to a middle tier server. Th...I'm having a problem with a proprietary JDBC driver to a middle tier server. The datasource that I have defined seems to work OK from a beanshell query but not from the sql or sql-query macros. The following is the result from sql-query, sql, and beanshell run:
The following is the code (beanshell code is modified copy from the scripts plugin page):
{sql-query:dataSource=PhsDev|output=wiki|showsql=true} select Fld1, Fld2 FROM Table WHERE Fld1 like '608174%' {sql-query} {sql:dataSource=PhsDev|output=wiki|showsql=true|transactionIsolation=none} select Fld1, Fld2 FROM Table WHERE Fld1 like '608174%' {sql} {beanshell} import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import javax.naming.InitialContext; import javax.sql.DataSource; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.NameNotFoundException; String dataSource = "PhsDev"; String sql = "select Fld1, Fld2 FROM Table WHERE Fld1 like '608174%'"; DataSource ds = null; Connection connection = null; PreparedStatement statement = null; ResultSet resultSet; try { ds = (DataSource) (new InitialContext()).lookup("java:comp/env/jdbc/" + dataSource); connection = ds.getConnection(); int isolation = connection.getTransactionIsolation(); out.println("<br>Isolation set: " + isolation); statement = connection.prepareStatement(sql); if (statement.execute()) { // result set is available resultSet = statement.getResultSet(); if (resultSet != null) { ResultSetMetaData rsmd = resultSet.getMetaData(); out.println("<br>Columns in result set: " + rsmd.getColumnCount()); // out.println("<br>Space names: "); while (resultSet.next()) { out.println("<br> " + resultSet.getString("Fld1") + " " + resultSet.getString("Fld2")); //"spacename")); } } } else { // only update count available out.println("Update count: " + statement.getUpdateCount()); } } catch (NameNotFoundException exception) { out.println(exception.toString()); } catch (NamingException exception) { out.println(exception.toString()); } catch (SQLException exception) { out.println(exception.toString()); } finally { try { if (resultSet != null) { resultSet.close(); } if (connection != null) { connection.close(); } } catch(Exception discard) { } } {beanshell}The following is the datasource definition:
<Resource name="jdbc/PhsDev" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/PhsDev"> <parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter> <parameter><name>driverClassName</name><value>com.phs.client.jdbc.PhsJDBCDriver</value></parameter> <parameter> <name>url</name> <value>jdbc:scwapi://host/NameServer;uid;pswd;db;schema;uid2;pswd2</value> </parameter> <parameter><name>maxActive</name><value>20</value></parameter> <parameter><name>maxIdle</name><value>10</value></parameter> <parameter><name>maxWait</name><value>-1</value></parameter> <parameter><name>removeAbandoned</name><value>true</value></parameter> <parameter><name>removeAbandonedTimeout</name><value>600</value> </parameter> <parameter><name>logAbandoned</name><value>true</value> </parameter> </ResourceParams>Versions used: Confluence Version: 2.6.0 Build:#913 Sep 27, 2007 on Tomcat 5.0.25
Also tried the transactionIsolation switches without success. Any ideas would be appreciated.
Thanks.
Oct 26, 2007
Bob Swift says:
Please write up an issue and it will be fixed in the next official release. In ...Please write up an issue and it will be fixed in the next official release. In the mean time, try this beta fix - that should at least get you through the setReadOnly not being supported by your driver. Make sure you use the {sql} macro and not the {sql-query} macro. But there is no telling what other problems the driver might run into
.
Oct 27, 2007
Quent Chalmers says:
The beta fix behavior is different but still not working. In the Phs server log...The beta fix behavior is different but still not working. In the Phs server logs I can see the connect and query being issued by nothing is ever displayed in the client browser... spinning IE globe forever.
Oct 28, 2007
Bob Swift says:
This issue is resolved with SQL-27This issue is resolved with SQL-27
Nov 09, 2007
Barry Caruth says:
Is there any way to reference a specific parameter by number rather than just '?...Is there any way to reference a specific parameter by number rather than just '?'. As it is I am having to repeat the same value many times to get the values plugged in to the right place in my queries.
Nov 10, 2007
Bob Swift says:
Parameter markers are SQL things so are just passed on through. I don't know of ...Parameter markers are SQL things so are just passed on through. I don't know of any SQL support for referencing parameter markers. I suppose the macro could do some simple replacements. Maybe p4=p3? If you want to pursue this, please write up an issue with suggestions and examples of what you want. You might also want to have a look at the Run Plugin - I use that a lot with SQL.
Dec 13, 2007
Imtiaz B Syed says:
Hi Bob, What is the status on the jira issue created on SQL Macro : SQL-...Hi Bob,
What is the status on the jira issue created on SQL Macro :
Can u suggest the jar compatibility such that which mysql jar should need to use to work it out and if possible attach that jar in attachments and let me know please.
Dec 14, 2007
Imtiaz B Syed says:
Hi.. Thanks for you comments in Jira for SQL-26. I know there is no such column ...Hi.. Thanks for you comments in Jira for SQL-26. I know there is no such column as 'syed' in SPACES table but thats the basic query and it is working in mysql very well with out any issues.
The exact problem is that if the macro finds any column or string tries to rename with keyword as 'as' then its getting failed. Even i know that its perfectly executing complex queries too. Only failing for 'as' keyword in queries.
Please have a look in such queries.
Thanks in Advance.
Dec 14, 2007
Bob Swift says:
The SQL macro doesn't do anything with your sql statement other than pass it to ...The SQL macro doesn't do anything with your sql statement other than pass it to the jdbc driver you have configured. It is up to jdbc and your database to evaluate the sql, so if there are problems with the evaluation of your sql, it is likely your database and jdbc driver.
Dec 18, 2007
Matt Klein says:
Hi Bob, I am trying to do a simple query that would return a date. select my_d...Hi Bob,
I am trying to do a simple query that would return a date.
select my_date from my_table;
The dates are just a date field in the oracle database, so the hh:mi:ss are 00:00:00. Using the sql-plugin when it displays the rows it displays the date with the 00:00:00. In other tools such as Toad or sqlplus it doesn't show the 00:00:00. Do you know why this is happening?
Thanks,
Dec 18, 2007
Bob Swift says:
Not sure what the other tools do. However, most databases have date functions t...Not sure what the other tools do. However, most databases have date functions that format dates. Google oracle date functions.
Dec 27, 2007
Peter Alfvin says:
Bob, If I want to use the output of a some arbitrary Confluence macro (e.g. a {...Bob,
If I want to use the output of a some arbitrary Confluence macro (e.g. a
{username} macro) as a variable in a sql macro, is there a preferred way to do that? For example, I'm looking to be able to do something like this within the body of sql macro:
select * from my_table where name='{username}'
Thanks,
Pete
Dec 27, 2007
Bob Swift says:
See if the Replace and Render Plugin does what you need. Other options for more...See if the Replace and Render Plugin does what you need. Other options for more complex interactions would be Run Plugin or Java Scripting Plugin.
Jan 15, 2008
David Tanner says:
Hi, I'm trying to run a select from a database into a table, where one field is ...Hi, I'm trying to run a select from a database into a table, where one field is editable and can be updated using the run plugin.
When actually running the update the following Oracle error is returned
sql: java.sql.SQLException: ORA-01453: SET TRANSACTION must be first statement of transaction
<UPDATE STATEMENT>
{sql-query:dataSource=test|output=wiki|} SELECT "TESTTABLE"."ID" as "id", '{run:replace=desc1:' || "TESTTABLE"."DESCRIPTION" || ':-\|titleRun=update} {sql:dataSource=testdb} UPDATE TESTTABLE SET DESCRIPTION = ''$desc1'' WHERE ID = ''' || ("TESTTABLE.ID") || ''' {sql} {run}' as "Description", FROM "TESTTABLE" {sql-query}Jan 21, 2008
John Kim says:
Hi, while trying to use this macro I got this error. sql-query: org.apache.tom...Hi, while trying to use this macro I got this error.
sql-query: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: ...... )
I thought it is similar problem with Mingy Liu's so I tried to find CONFLUENCE_HOME/confluence.cfg.xml file, but this file does not exist.
Maybe it's because I'm using Confluence is 2.5.7
Can anyone help me? thanks
While I'm at it, I have one more question. I don't know where to post this so I will post it here...
I'm currently retrieving an image from remote location to Wiki page by using !http://www.example.com/examplepic!
This works fine and when I print it, the image is there.
But when I create a PDF file, it says "Cannot resolve external resource into attachment."
This is because I didn't save this image as an attachment.
So is there any macro/plugin that can save image as an attachment?
I cannot simply download image and attach because this image will change all the time.
Anyone can help?
Thanks so much.
Feb 05, 2008
Adam says:
I am hoping someone can help with a little dilema I'm in. I have been using the ...I am hoping someone can help with a little dilema I'm in. I have been using the sql plugin quite extensively
and have just recently accidently created a page that when opened causes my server to run out of memory and become unresponsive.
Is it possible to either open the page in edit mode directly (ie without first viewing it) or delete the page without viewing it.
Adam
Feb 06, 2008
Bob Swift says:
I use the Confluence CLI. Get the page source, modify, and then store. In your ...I use the Confluence CLI. Get the page source, modify, and then store. In your case, I would also render using the CLI first to make sure it it renders as expected.
Feb 06, 2008
Bill Winett says:
I had the same problem. One of the guys here came up with a great way of r...I had the same problem. One of the guys here came up with a great way of resolving this - but it only works if you have implemented security with this. If you have, remove the restrictions from the page. The SQL on the page will no longer execute, so you can edit the page. To remove restrictions from the page:
Feb 07, 2008
Sasha Zucker says:
We started using this plugin last night and ecountered a problem in which the sq...We started using this plugin last night and ecountered a problem in which the sql macro tried to query a database that was in the process of being rebuilt. The result was that tomcat seemed to crash and had to be restarted. Is this a problem that you have seen before?
Feb 07, 2008
Bob Swift says:
No. What error information was in the logs? If you have that information, log an...No. What error information was in the logs? If you have that information, log an issue and put it there. Since the plugin relies on standard Java SQL access libraries, the problem might be lower level Java or Tomcat. You do need to be careful with your SQL that the results are a reasonable size within your JVM memory constraints.
Feb 15, 2008
Bob Swift says:
It is most likely a configuration error. You can do some research following thi...It is most likely a configuration error. You can do some research following this. Your data is a bit messed up. For example what is actory="org.objectweb.jndi.DataSourceFactory". If you still have problems, I suggest creating an issue and attach your server.xml file. Copy your markup but make sure you enclose it within {noformat} macro.
Feb 18, 2008
Chris Wendell says:
Hi Bob; Thanks for the reply. The data you asked about is from a post by ...Hi Bob;
Thanks for the reply. The data you asked about is from a post by Michael Ogrinz on Apr 28, 2006 at 14:58. It is suposed to be "factory" not "actory" I could not get it to work with "factory" so I have remove the line. Yes I a sure I have
Something messed up in my configuration but what I have no idea. Does the rest of this file look OK?
Feb 19, 2008
Chris Wendell says:
Hi Bob; Well I was just about to beg for help but I tried one las test and it w...Hi Bob;
Well I was just about to beg for help but I tried one las test and it worked This is what I did:
I have an Oracle 11g database using the ojdbc1.6
<Resource
name="jdbc/UTL01PDBuild"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(PORT=1521)(HOST=warhawk))(CONNECT_DATA=(SID=UTIL01PD)))"
username="build_wiki"
password="xxpasswordxx"
connectionProperties="SetBigStringTryClob=true"
maxActive="25"
maxIdle="5"
maxWait="10000"
/>
Feb 18, 2008
Jeff Branc says:
I'm afraid i may know the answer to this already, but need to ask anyway i hav...I'm afraid i may know the answer to this already, but need to ask anyway
i have a table that has customer/project status. it will return Green, Yellow or Red. i wrote a user macro that will do a replaceAll turning Green into
Green, Yellow into (!) Yellow and so on. this macro works great around normal text and even wiki tables. however, it does nothing when i wrap it around a SQL query that is set to output=wiki.
i'm thinking this is trying to substitute before the sql macro fully outputs its wiki table, but wanted to run it by you. any ideas?
Feb 18, 2008
Bob Swift says:
I suggest you just modify the SQL statement to create the modified values using ...I suggest you just modify the SQL statement to create the modified values using a case statement statement. When column value = 'Green' then '
Green'.
Feb 19, 2008
Jeff Branc says:
one other thing i noticed: the cache plugin, when wrapped around the sql macro,...one other thing i noticed: the cache plugin, when wrapped around the sql macro, prevents table sorting, highlighting, etc. however, autototal works. also, the sortIcon parameter does not seem to get passed through.
---
just as i decided to write this, the consistent behavior of it not working suddenly went away, and now cached tables sort and sortIcon works. hmph.
Mar 08, 2008
Peter Alfvin says:
Hi Bob, I've really been enjoying the power of the combination of {run} and {sq...Hi Bob,
I've really been enjoying the power of the combination of
{run} and {sql}, but I'm wondering if I'm using the two optimally, particularly with respect to dealing with session information and using sql to construct other sql. The basic pattern I've been using is to use {sql} to construct data-driven URL links which invoke a {run} macro which in turn is wrapped around
{sql} to do the actual work. I'm associating session information with the current logged in user via a sql table and passing the current logged in user as a parameter via the run URL mechanism.
I'm using this mechanism, for example, to enable users to make changes to an SQL table by generating a URL link on each row to invoke {run} to edit that row, etc. I always pass the current user as a parameter to run so that the sql can get at the session information associated with that user.
Is this as good as it gets? Are there other models you can recommend?
Pete
Mar 08, 2008
Bob Swift says:
Peter, it is hard to tell exactly what you are doing, but, yes, you are probably...Peter, it is hard to tell exactly what you are doing, but, yes, you are probably doing the best you can given what is currently supported. Interesting that you should bring this topic up at this time
since some enhancements are in progress making some more complex scenarios similar to yours possible. I plan to put out an example page on how some of these techniques can be used. Watch for a new Run Plugin beta followed by an updated sql - perhaps you can test them out and see if you have additional requirements.
Mar 09, 2008
Peter Alfvin says:
Bob, looking forward to the Run beta. One quick follow-up: Do you know of any wa...Bob, looking forward to the Run beta. One quick follow-up: Do you know of any way to control the execution order of macros/plugins? Right now, it appears that the macro I've defined to get the logged in user info is expanded after the SQL is executed. This forces me to use the Run plugin with external URL to pass the user information to the SQL queries rather than just being able to do something like:
select * from session_info where user='{getuser}'
Mar 09, 2008
Bob Swift says:
Using the Run Plugin beta that includes Run-9, just use something like: {run:.....Using the Run Plugin beta that includes Run-9, just use something like:
{run:...} {sql:...} select * from session_info where user = $current_user_id {sql} {run}Mar 14, 2008
Stefan Kunz says:
I would like to define the number of decimal places per column. As I have to cal...I would like to define the number of decimal places per column. As I have to call predefined stored procedures I am not able to modify the sql syntax itself. Is there another possibility elsewhere?
Mar 14, 2008
Bob Swift says:
Use SQL cast or similar function supported by your database.Use SQL cast or similar function supported by your database.
Apr 16, 2008
Bharathi says:
Hi , I have some new requirement for this SQL macro. If you can provide me some ...Hi ,
I have some new requirement for this SQL macro. If you can provide me some suggestion on implementation , i would like to work on it.
The requirement is that suppose a select sql has a column which is of Array type, example float[] , then the output should display all the values for this array as separate rows. also if there is a column in the select sql which is not an array type , the value of this column should be repeated on each row of the array.
Please let me know if it is not clear. I wrote some java code to do it but i would like to customize the SQL Marco so that, i can make better use of confluence, otherwise I might have to think of different options to develop an application which is more data orientanted -doesnot have much business requirement.
Thanks so much for your help
Bharathi
Apr 16, 2008
Bob Swift says:
I suggest you create an issue and we can discuss there. It would be less compli...I suggest you create an issue and we can discuss there. It would be less complicated to implement, more usable, and cover cases of multiple array fields if the output of an array field is still a single cell but has multiple lines, one for each array element.
Apr 16, 2008
Bharathi says:
Thank you so much Bob for your reply. I created an issue " PLUG-64 ...Thank you so much Bob for your reply. I created an issue " PLUG-64 -SQL Macro need to handle array data type " for this . Yeah , I can understand your point ,but i am thinking about the presentation layer too. So would it look like Master Datail kind of table structure?
Please let me know .
Thanks
Bharathi
Apr 16, 2008
Bob Swift says:
Ok, except the SQL plugin issue tracking is http://developer.atlassian.com/jira/...Ok, except the SQL plugin issue tracking is http://developer.atlassian.com/jira/browse/SQL (see top of this page).
Apr 17, 2008
Bharathi says:
Oh Yeah I got it now . ..okay i created one SQL-32 in this issue tracking. Thank...Oh Yeah I got it now . ..okay i created one SQL-32 in this issue tracking.
Thanks
Bharathi
Apr 29, 2008
Doods Perea says:
Hi Bob - I added JIRA connection details to my Confluence server.xml but could n...Hi Bob - I added JIRA connection details to my Confluence server.xml but could not get it to work. Confluence works just fine. Could you please help identify what's wrong with these entries?
SERVER.XML
<Context path="" docBase="../confluence" debug="0" reloadable="false">
<Resource name="jdbc/confluence" auth="Container" type="javax.sql.DataSource" username="CONFUNAME" password="PWD1" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/aoconfluence?autoReconnect=true&useUnicode=true&characterEncoding=utf8" validationQuery="Select 1" />
<Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource" username="JIRAUNAME" password="PWD2" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/jiradb?autoReconnect=true&useUnicode=true&characterEncoding=UTF8" maxActive="20" factory="org.apache.commons.dbcp.BasicDataSourceFactory" />
<Manager pathname="" />
</Context>
WEB.XML
<resource-ref>
<description>Connection Pool</description>
<res-ref-name>confluence</res-ref-name>
<res-type>javax.sql.Datasource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
In my SQL Plugin I got this:
{sql:dataSource=jiraDS|showsql=false}
select 'USERS' as Type, count(distinct username) as "Count" from USERBASE
{sql}
The ERROR that I get is: sql: dataSource: jiraDS not found.
Thanks,
Apr 29, 2008
Bob Swift says:
I am having a hard time parsing your comment. Please surround your copied data ...I am having a hard time parsing your comment. Please surround your copied data by {noformat} or {code:xml} blocks and use preview to make sure it looks right. The error that currently shows up in the comment indicates you have not installed the sql plugin, but I think that is just because its being interpreted in the comment. Make sure you include your wiki markup.
Apr 29, 2008
Doods Perea says:
Hello again Bob, I updated the comment above. I hope it is readable this ...Hello again Bob,
I updated the comment above. I hope it is readable this time. Thanks much for your help.
Apr 29, 2008
Bob Swift says:
The datasource lookup is case sensitive, so change to use dataSource=JiraDSThe datasource lookup is case sensitive, so change to use dataSource=JiraDS
Apr 29, 2008
Doods Perea says:
Thanks Bob - of course that was the culprit Everything works fine now. ...Thanks Bob - of course that was the culprit
Everything works fine now.
Regards,
May 01, 2008
Bharathi says:
Thanks for the helpThanks for the help
Apr 29, 2008
Bob Swift says:
You need to do some generic developer setup - see http://confluence.atlassian.co...You need to do some generic developer setup - see http://confluence.atlassian.com/display/DEVNET and more specifically http://confluence.atlassian.com/display/DEVNET/How+to+Build+an+Atlassian+Plugin.
May 01, 2008
Bharathi says:
Bob, Thanks so much for all your help BharathiBob,
Thanks so much for all your help
Bharathi
Apr 30, 2008
Bob Swift says:
That comes from the scriptutil jar that is bundled as part of the maven2 build p...That comes from the scriptutil jar that is bundled as part of the maven2 build processing for atlassian plugins. Verify that your jar matches the normal jar structure for the shipped jar. If it does not, then your build setup is wrong.
I would appreciate it if further discussions are needed that it be moved to an issue and perhaps remove the build logs from your previous post. This really isn't a developer's forum and these comments are clutter for most users of the sql plugin.
May 16, 2008
Christophe Bonvin says:
I am looking for a way to pass a dynamic parameter into the SQL sentence, as for...I am looking for a way to pass a dynamic parameter into the SQL sentence, as for exemple the page name or a subset of a page name or data coming from variable of a scaffold template. I have tried to understand how it could be done using the run macro, but did not get any success. This question is almost the same as the one raised by Derek Stevens on Apr 11, 2006.
I want to implement some drill down from the result of a sql list where a column will have a link to a new page, created, if not already existing, from a template which contain a sql request for collecting more details.
Let say, I have a SQL statement that return a list of projects, with project number, project name, manager, status.... I would like to make a link from the project number (easily done with the SQL request with some concat statements) that will be used to create (or link to) a page containing project details and latest figures about the project, like hours spend, invoices sent, ... coming from a sql query. So I need to pass the project number from the list of the parent page, using the link, into the SQL statement of the child page beeing created based on a template.
I would appreciate any help (directions or better, code sample).
Christophe
May 16, 2008
Bob Swift says:
I really need to put together some advanced example pages, but in the meantime h...I really need to put together some advanced example pages, but in the meantime here are some hints and maybe if you get it working you can share. We use combinations of the Run Plugin and Replace and Render Plugin for doing more complex things like this.
Method 1 - dynamic page
Method 2 - replace and render
May 16, 2008
Ryan says:
If you do put together examples, I would love to see one that showed the link fr...If you do put together examples, I would love to see one that showed the link from the parent page, with parameters and the code on the receiving page in total. Without knowing the syntax to properly create links with variables and how to use them in a subsequent page, examples go a long way in understanding what needs to happen.
Jun 10, 2008
Andree Toonk says:
Hi, I have a MySQL table with some contact information (name, email, address, p...Hi,
I have a MySQL table with some contact information (name, email, address, phone etc...).
What I would like is that users can update this data from their confluence space.
Ideally this would be some kind of form in which users update the information and then the SQL plugin would be used to execute the UPDATE statement.
Is this possible? If so how? Does someone have an example of how to do this?
Thanks for the help,
Andree
Jun 10, 2008
Bob Swift says:
You can use the Run Plugin for the form and the sql macro to do the update.You can use the Run Plugin for the form and the sql macro to do the update.
Jun 17, 2008
Liam Gavin says:
I can't get this to work, we are using Tomcat 5.5.23 with SQL 2005 backend. I ha...I can't get this to work, we are using Tomcat 5.5.23 with SQL 2005 backend. I have copied the jtds-1.2.2.jar into the lib folder and added the following text to the server.xml file:
When I add this text to a page:
{sql-query:dataSource=sql|output=wiki} select * from TB_REPORT {sql-query}I get:
sql-query: dataSource: sql not found.
select * from TB_REPORT
Any help would be much appreciated as this looks like a really good plugin!
Cheers,
Liam
Jun 17, 2008
Bob Swift says:
Did you mean <Resource name="jdbc/sql" ...? Did you put the jtds jar file ...Jun 18, 2008
Liam Gavin says:
1. Yes 2. It is saved in C:\wamp\www\confluence-2.8.1-std\common\lib which is t...1. Yes
2. It is saved in C:\wamp\www\confluence-2.8.1-std\common\lib which is the install dir
3. Searched the catalina.2008-06-17.log file for "sql" but found nothing, only thing that stands out is this message:
WARNING: Exception Processing ErrorPage[errorCode=500, location=/500page.jsp]
ClientAbortException: java.net.SocketException: Software caused connection abort: socket write error
Is this related?
All other log files are 0b.
Thanks,
Liam
Jun 18, 2008
Bob Swift says:
Probably not. Also check the atlassian-confluence.log in your home logs director...Probably not. Also check the atlassian-confluence.log in your home logs directory. Your configuration looks ok - we use the same jdbc driver. Perhaps someone else can help suggest how to resolve tomcat datasource issues. I check jdbc database access using a database access tool (QuantumDB from Eclipse for instance).
Jun 19, 2008
Liam Gavin says:
That log file is showing something, this error message keeps appearing: org.spr...That log file is showing something, this error message keeps appearing:
org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: Could not execute query; bad SQL grammar []; nested exception is java.sql.SQLException: Invalid column name 'title'.
Caused by: java.sql.SQLException: Invalid column name 'title'.
I have tried changing the query, specifying columns etc and this message always appears, any ideas?
Liam
Jun 20, 2008
Liam Gavin says:
Looks like a Friday afternoon gotcha, the Confluence database has picked up the ...Looks like a Friday afternoon gotcha, the Confluence database has picked up the server's case sensitive setting!!!
There are four tables in Confuence DB with column TITLE:
ATTACHMENTS
CONTENT
TRACKBACKLINKS
CONTENTLOCK
Is this the problem? and Is there anyway of changing the macro behaviour or do I need to backup and recreate the DB case insensitive? Would be a bit of a hassle as we have created quite a few pages but it is possible.
Have a good weekend!
Liam
Jul 01, 2008
Liam Gavin says:
Hi, Can I get some feedback on this? Cheers, LiamHi,
Can I get some feedback on this?
Cheers,
Liam
Jul 01, 2008
Bob Swift says:
I suggest opening an issue and providing more details of what you are trying to ...I suggest opening an issue and providing more details of what you are trying to do. Specifically your wiki markup, error message and sample query results you get with the query using a SQL tool. Also provide the full stack track from your hibernate error. Check to make sure there is something in the stack trace that relates to the sql macro, otherwise its an Atlassian issue.
Jun 17, 2008
Rwan says:
I have a requirement where i need to query the database and display the values i...I have a requirement where i need to query the database and display the values in table format with column sort option.SQL Query:
select * from EMP_REPORT
Output:
1. Will the SQL plugin alone suffice ?
2. I know Table Plug in has column sort option, how can I integrate Table plugin with this SQL plugin to fulfill my needs?
3. How can I show my report in table format effectively with the help of plugins?
4. I need to export the table in CSV format, will I able to use CSV Macro ?
I am novice to this area, so any sample code will be of great help for me.
Thanks in advance,
Rwandan
Jun 17, 2008
Bob Swift says:
Yes. The sql macro supports all the Common table capabilities. Also, use the...Jun 18, 2008
Rwan says:
Bob, Thanks for the reply. Is it possible to use SQL plugin to display the data...Bob,
Thanks for the reply. Is it possible to use SQL plugin to display the data in table format (along with column sorting)?
If yes, then kindly provide me a sample on how to achieve this?
Thanks,rwan
Jun 18, 2008
Bob Swift says:
Not quite sure what you mean. Your example above should be all you need. The d...Not quite sure what you mean. Your example above should be all you need. The default is table format as your example shows and basic string sorting is also the default, just click on the column heading to sort. If you want to do automatic sorting on display, then use order by clause in sql and/or look at the examples in Common table capabilities for sortColumn etc...
Jun 19, 2008
Jessica King says:
The sortIcon parameter doesn't work for me. I'm on Confluence 2.7 and SQL Plugin...The sortIcon parameter doesn't work for me. I'm on Confluence 2.7 and SQL Plugin 3.4.0. The sort works, but the url for the icon is
http://confluenceURL/download/resources/org.swift.confluence.sql:sql/img/down.gif
and results in a broken image link icon. I tested the url
http:///confluenceURL/download/resources/org.swift.confluence.sql/img/up.gif
and that works. Anybody else have this problem or know how I can fix it?
Thanks,
Jessica
Jun 20, 2008
Bob Swift says:
hmmm... not seeing this problem here.hmmm... not seeing this problem here.
Jun 23, 2008
Evan Kirkland says:
I am trying to make use of this SQL plugin and I think I should be able to do wh...I am trying to make use of this SQL plugin and I think I should be able to do what I want. I want the queries to be defined in a file on the server so that the database structure is not readily available in the wiki markup, but I need these to be paramaterized. When I use the run plugin I can paramatarize a query that is in the wiki markup, but is it possible to use it or something else to paramaterize a query that is in a file on the server?
Thanks!
Evan
Jun 23, 2008
Bob Swift says:
You can use the script=#filename parameter together with parameter markers.You can use the script=#filename parameter together with parameter markers.
Jun 23, 2008
Evan Kirkland says:
Thanks for the reply Bob. I actually thought of that a few minutes after ...Thanks for the reply Bob.
I actually thought of that a few minutes after posting the question and after reading through this page more closely. But I seem to now be experiencing some problems using parameter markers. If I put a ? in my query and don't define a p1 I get the appropriate error, so it is recognizing the ?. But when I do define a p1 it doesn't seem to be replacing it.
Here is the test code I am playing with (I just forgot about the file for now until I can get an inline one working).
{sql-query:dataSource=testDataSource\|output=wiki\|showSql=true\|p1='blah'} select * from projects where description=?; {sql-query}The query that is output when I run is:
Any idea why the ? is not being replaced with the p1 value? Or am I missing something.
Thanks again!
Evan
Jun 23, 2008
Evan Kirkland says:
Sorry, I didn't realize that was an SQL thing. Its working fine. Th...Sorry, I didn't realize that was an SQL thing. Its working fine.
Thanks for the help!
Jul 03, 2008
Matt Howell says:
I realize this could introduce security issues (SQL Injection, etc.) for some us...I realize this could introduce security issues (SQL Injection, etc.) for some users, but is there any way to pass in a URL Parameter to page containing the SQL macro, and have it passed as a parameter to the query at runtime?
In our situation, we only run queries against our reporting server which is Read Only.
Jul 03, 2008
Matt Howell says:
Looks like the Run Plugin, mentioned above, will do it.Looks like the Run Plugin, mentioned above, will do it.
Jul 22, 2008
Evan Kirkland says:
We would like to have the data source configuration moved into the plugin config...We would like to have the data source configuration moved into the plugin configuration screen rather than the server.xml file. Are there any plans to do this by any chance?
Jul 22, 2008
Bob Swift says:
Evan, yes, I have been thinking about adding plugin configured datasources in ad...Evan, yes, I have been thinking about adding plugin configured datasources in addition to the server datasources. Please right up an issue and describe any specifics of what you would like to see.
Jul 23, 2008
Evan Kirkland says:
Thanks Bob! I created the issue: http://developer.atlassian.com/jira/...Thanks Bob!
I created the issue: http://developer.atlassian.com/jira/browse/SQL-38
I will keep tabs on the updates made to that issue so if you have any further questions for me just make a comment on the issue.
Thanks again!
Evan
Jul 22, 2008
Jeff Guthrie says:
Is it possible to replace the p1, p2 values in the query with user input on the ...Is it possible to replace the p1, p2 values in the query with user input on the page or captured on a previous page?
Jul 22, 2008
Bob Swift says:
Use the Run Plugin or the Replace and Render Plugin for things like that.Use the Run Plugin or the Replace and Render Plugin for things like that.
Jul 29, 2008
Christophe Bonvin says:
Hello, I have a small issue when I use the chart macro with sql data and after ...Hello,
I have a small issue when I use the chart macro with sql data and after that a sql request displaying information in the table format like outloined below:
{chart} {sql-query:dataSource=source|table=false} select name, sum(amount) from anytable group by name {sql-query} {chart} {sql-query:dataSource=source|output=wiki|autoTotal=true|enableSorting=true} select name, amount, date from anytable {sql-query}It seems that special options in the table display like autoTotal or sorting by clicking on the heading do not work if the table is placed after a chart.
Any idea ?
Thanks
Jul 29, 2008
Bob Swift says:
This is TBL-44. The chart macro prevents the inclusion of the java script unles...This is TBL-44. The chart macro prevents the inclusion of the java script unless datadisplay=true. Use the workaround in the issue until this gets fixed permanently.
Jul 29, 2008
Christophe Bonvin says:
Workaround works perfect, I just added and everything is fine now. ThanksWorkaround works perfect, I just added
Aug 08, 2008
Roland König says:
Hello, is there any possibility to run PL/SQL Procedures within the sql - macro...Hello,
is there any possibility to run PL/SQL Procedures within the sql - macro. I tried to do so, but I get an error ORA-00900: invalid SQL statement.
My simple test procedure looks like:
PROCEDURE Test
IS
dfg number ;
BEGIN
dfg := 0;
begin
dbms_output.put_line('Have a nice day ...');
end;
end Test;
Thanks!
Roland
Aug 08, 2008
Bob Swift says:
No, it has to be a sql statement (select, insert, delete, update, create, ...) t...No, it has to be a sql statement (select, insert, delete, update, create, ...) type of statement - something you could run from something like the pgAdmin SQL query dialog for instance.
Mar 23, 2009
Lesley Groh says:
Hi Bob, Are there any plans to add the functionality for the use of stored proce...Hi Bob, Are there any plans to add the functionality for the use of stored procedures in an upcoming version of the SQL plugin? Thanks, Lesley
Aug 27, 2008
nico emanuelsson says:
Since i had major problems with this plugin getting access to my datascourc...Since i had major problems with this plugin getting access to my datascources on sql 2005 i just thought i'd paste my server.xml config here in case others have the same problems.
sqljdbc.jar version 1.2 in /common/lib and set as classpath in system env(CLASSPATH=C:%Confluence_home%\common\lib\sqljdbc.jar).
Recource name (in ths case timereporting) in web.xml at the bottom.
But in future versions i really hope the config can be integrated with the plugin-setup.
Aug 27, 2008
Bob Swift says:
Thanks for posting! If you have further problems, the jtds jdbc driver is an alt...Thanks for posting! If you have further problems, the jtds jdbc driver is an alternative for MS SQL server.
Mar 18, 2009
Ghalib Ghuneim says:
Hi Bob, If you will use jtds jdbc driver you need to copy ...Hi Bob,
If you will use jtds jdbc driver you need to copy jtds-1.2.2.jar to <install-directory>\lib after installing the plug-in and all will work perfect, no sign needed there, do not forget to restart tomcat
thank you
Sep 01, 2008
Jens Dein says:
window.SyntaxHighlighter.config.clipboardSwf = '/s/1724/13/2/_/download/resou...<ResourceLink global='jdbc/jiraDS' name='jdbc/jiraDS' type="javax.sql.DataSource"/> <Resource name="jdbc/jiraDS" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/jira-ent" username="yyy" password="xxx" maxActive="25" maxIdle="5" maxWait="10000" />Hi, I have added this xml to my server.xml in order to be able to query my jira database on the same server - but I can't seem to get pass an error message saying :
Any idea what the problem might be? I'm using Confluence 2.8.2, also running on postgresql.
Sep 02, 2008
Bob Swift says:
Resource configuration looks normal assuming it is defined within the confluence...Resource configuration looks normal assuming it is defined within the confluence context. I am not familiar with the use of resource link - have you tried it without that?
Sep 02, 2008
Jens Dein says:
I did that now, and got this error instead : org.apache.tomcat.dbcp.dbcp.SQLNest...I did that now, and got this error instead :
but I don't understand that, because Confluence is running on postgres - and working are fine
Sep 03, 2008
Bob Swift says:
Make sure your postgres driver jar is in .../common/lib.Make sure your postgres driver jar is in .../common/lib.
Oct 19, 2008
Stuart Gilberd says:
I have just tried using a resource link and it doesn't seem to work. The change...I have just tried using a resource link and it doesn't seem to work. The change I made to the above configuration is to define the Resource in the GlobalNamingResources and the ResourceLinks in the context section.
My reason for doing it this way was that we had moved from one resource to another due to tidy up our security. There were a lot of calls to the SQL plugin so at a certain point we redefined the original Resource to point to the same database and credentials as the second. For some reason we have received weird behaviour where one of the datasources stopped working and the other worked and then they would flip (working one stopped working, non working one started working). So I decided a ResourceLink might help - it would at least be tidier.
Sep 04, 2008
Scott Holliday says:
Wow, that was an intense afternoon of troubleshooting trying to get the SQL plug...Wow, that was an intense afternoon of troubleshooting trying to get the SQL plugin working for my situation.
But finally got it working and its great. Just like to thank you Bob Swift for all your contributions to Confluence.
I was basically just trying to connect an external MS SQL 2005 database, which is actually simple but because there was no direct intructions this page just confused me
All good now, cheers!
Sep 11, 2008
Mike Mitton says:
Scott, I am trying to do the same thing (connect to an external MS SQL 2005 data...Scott,
I am trying to do the same thing (connect to an external MS SQL 2005 database) and not having any luck. I am getting "sql-query: dataSource: jdbc/GroundTruthResults not found." error. Any insight to how you got this working would be greatly appreciated.
Sep 12, 2008
Mike Mitton says:
Nevermind, I need to pay WAY more attention to the syntax of the macro. I appe...Nevermind, I need to pay WAY more attention to the syntax of the macro.
I appended "jdbc/" in front of the datasource parameter, exactly as it says not to do in the documentation.
Sep 12, 2008
Carol Geng says:
I have a sql statement: select pagename, pageurl from test_page I need to disp...I have a sql statement:
select pagename, pageurl from test_page
I need to display pagename with the pageurl anchor if the pageurl is not null.
I had a marco like this:
riteurl: pagename|pageurl
How could I pass the pagename, pageurl to the riteurl macro?
Thanks,
Carol
Sep 13, 2008
Bob Swift says:
Not sure what you mean or what you are trying to do. Note that you can use sql ...Not sure what you mean or what you are trying to do. Note that you can use sql syntax (case statement for instance) to produce different outcomes based on values (like null) for columns coming back from the query.
Sep 13, 2008
Carol Geng says:
Hi Bob, Sorry for the confusion. I don't have problem for the sql statement. ...Hi Bob,
Sorry for the confusion.
I don't have problem for the sql statement.
I have a table, for example, containing pageName, pageURL two fields. And I have the following data:
google Home Page google.com
another web site null
I need to display the result like this:
[google Home Page] (comment: 'google Home Page' is linked to google.com because it is the value of pageURL)
another web site (comment: 'another web site' has no link beause its url is null)
Can I format the data with link or without link based on the pageURL value?
Thanks for the help!
Carol
Sep 13, 2008
Bob Swift says:
Yes. For example, if you use postgres, the sql would be something like: windo...Yes. For example, if you use postgres, the sql would be something like:
Sep 14, 2008
Carol Geng says:
Hi Bob, This is what I need: select case when pageURL is null then pageName els...Hi Bob,
This is what I need:
select case when pageURL is null then pageName else '<a href=' || pageURL|| '>' || pageName || '</a>' end
It runs fine from Oracle SqlPlus command line. But it sends me this error from confluence (I did copy and paste the sql statement):
sql-query: java.sql.SQLException: ORA-00911: invalid character
select case when pageURL is null then pageName else '<a href=' || pageURL || '>' || pageName || '</a>' end
Thanks,
Carol
Sep 15, 2008
Carol Geng says:
Hi Bob, Here is what happened: I saved the following sql and it is fine this t...Hi Bob,
Here is what happened:
I saved the following sql and it is fine this time:
select case when pageURL is null then pageName else '<a href=' || pageURL|| '>' || pageName|| '</a>' end
After I opened it again, the sql became this one:
select case when pageURL is null then pageName else '' || pageName|| '' end
Any idea?
Many thanks,
Carol
Sep 25, 2008
Carol Geng says:
We found it out that Rich Text dropped the code.We found it out that Rich Text dropped the code.
Sep 13, 2008
foobar says:
Based on what I have read, I believe what I'm trying to do is possible. There is...Based on what I have read, I believe what I'm trying to do is possible. There is a lot of good information on this page, but nothing that describes how to achieve my goal concisely... so here it goes.
I'd like a page with a form that has a text input, at least three radio buttons, and a submit. When a user submits, the text input and selection become part of the query for the sql plugin and a new page is displayed with the output of the query.
In my case, the text input and radio button would be used in the where clause of the sql server.
For example, if the form had the following:
Text Input: emplyee infromation (with a text input box)
Radio buttons: First Name, Last Name, Department
If the user typed Smith in the text input and selected the "Last Name" radio button then clicked submit, the query would be something like this: select * from employees where lastName="Smith' and the page is updated with the output of the query and the form allowing them to search again.
Sep 13, 2008
Bob Swift says:
The Run Plugin used in combination with the sql macro will do the text input par...The Run Plugin used in combination with the sql macro will do the text input part of this, but there is no support for radio buttons.
Sep 15, 2008
foobar says:
To bad about the radio buttons. Otherwise, works exactly as advertised. Thanks...To bad about the radio buttons.
Otherwise, works exactly as advertised.
Thanks!
Sep 25, 2008
Carol Geng says:
Hello, Anybody has an exmaple how to use sql plugin along with content format ...Hello,
Anybody has an exmaple how to use sql plugin along with content format macro?
http://confluence.atlassian.com/display/CONFEXT/Content+Formatting+Macros
The following code won't dispaly the color, instead, it will just display something like ' {bgcolor:Green}02/23/2008 {bgcolor}': select '{bgcolor:' || trackingColor || '}' || trackingdate || '{bgcolor}' from wiki_test where trackingid = '1' But if I just list the '{bgcolor:Green}02/23/2008 {bgcolor}' in wiki, it displays the date in green background.Thanks a lot!
Carol
Sep 27, 2008
Gavin Fowler says:
Hi. Being a newbie to JBoss, confluence, etc, I had a hard time getting this plu...Hi. Being a newbie to JBoss, confluence, etc, I had a hard time getting this plugin working with my configuration (Confluence 2.8.1, JBoss 4.2.0 GA, Apache 2.0.54 - all running from a [Fedora Core 4] installation). I thought I'd outline the steps I followed to extract data from an Oracle 9.2.0.4 data repository.
Step 1. Install the SQL plugin.
I used the Confluence "Administration"/ "Plugin Repository" to install.
Step 2. Create your datasource file in the JBoss deploy folder used by your confluence installation: /{my jboss install dir}/server/{my confluence dir}/deploy/
For my installation the actual folder location / file name was:
Step 3. configure your datasource file ('oracle-ds.xml') to use your oracle server credentials.
<!-- ==================================================================== --> <!-- Datasource config for Oracle originally from Steven Coy --> <!-- ==================================================================== --> <datasources> <local-tx-datasource> <jndi-name>OracleDSSageUSDev</jndi-name> <connection-url>jdbc:oracle:thin:@hostname.us.sagepub.org:1521:sageus</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <user-name>???***???</user-name> <password>***???***</password> <min-pool-size>20</min-pool-size> <max-pool-size>50</max-pool-size> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <metadata> <type-mapping>Oracle9i</type-mapping> </metadata> </local-tx-datasource> <local-tx-datasource> <jndi-name>OracleDSSageUKDev</jndi-name> <connection-url>jdbc:oracle:thin:@hostname.us.sagepub.org:1521:sageuk</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <user-name>???***???</user-name> <password>***???***</password> <min-pool-size>20</min-pool-size> <max-pool-size>50</max-pool-size> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <metadata> <type-mapping>Oracle9i</type-mapping> </metadata> </local-tx-datasource> </datasources>Step 4. Stop and restart your JBoss instancing running Confluence.
Step 5. Create a test page for 'SQL Plugin'
{sql-query:dataSource=java:OracleDSSageUSDev|output=wiki|escape=true} select product_id, title from my_product_table where rownum < 20 order by product_id {sql-query}Oct 26, 2008
Garth Ralston says:
Hi, This may have been covered earlier but I can't seem to find anything that s...Hi, This may have been covered earlier but I can't seem to find anything that specifically helps.
I'm trying to create a page with a query that includes the currently logged in wiki user as a parameter.
Please see the code below. Where I have the parameter p1, I'd like to replace that with a macro (or something) that means that p1 will contain the userid of the currently logged in user. Any assistance would be greatly appreciated!
h3. My Visitors {sql-query:datasource=confluence|p1=gralston|showSql=true} SELECT company, visitor, date_of_visit FROM OFFICE_VISITORS where created_by = ? order by date_of_visit desc {sql-query}Oct 26, 2008
Bob Swift says:
Look at the Run Plugin and specifically this example.Look at the Run Plugin and specifically this example.
Oct 29, 2008
Carol Geng says:
Hello, Do you have examples on how to use sql-query1 and sql-query2? I have a ...Hello,
Do you have examples on how to use sql-query1 and sql-query2?
I have a table having departmentId and departmentName, another table having departmentId and employeeName. I like to display the result like this:
departmentName employeeName1 employeeName2 employeeName3... in one row.
wondering if this can be done?
Thanks,
Carol
Oct 29, 2008
Bob Swift says:
Well you are on the right track, you do need sql-query2. Here is an outline - y...Well you are on the right track, you do need sql-query2. Here is an outline - you will have to get the sql right
. If you have trouble with the inner sql statement format, set autorun=false and test out the generated sql statement separately:
{sql-query:datasource=xxxxx|output=wiki} select departmentName, '{run:autorun=true|hideRun=true|hideParameters=true} {sql-query2:table=false|datasource=xxxxx} select employeeName || '', '' from sometable where departmentId = ''' || departmentId || ''' {sql-query2} {run}' as "Dept members" from sometable {sql-query}Oct 31, 2008
Carol Geng says:
Hi Bob, Something wrong here: Table Project: projectId projectName 1 marketing...Hi Bob,
Something wrong here:
Table Project:
projectId projectName
1 marketing
2 engineering
Table project_tracking
projectId TrackingItem TrackingDate TrackingStatus TrackingURL
1 Advertising 12/02/2008 Green
1 Demo 12/05/2008 Red http://demo
2 Prototype 11/2/2008 http://waytogo
2 FinalTesting 12/15/2008 Red http://done
{sql-query:datasource=test|output=wiki|table=true|heading=1} select projectName, '{sql-query2:table=false|datasource=test} select case when trackingurl is null then ''<td bgcolor='' || trackingstatus || ''>'' || trackingdate || ''</td>'' else ''<td bgcolor='' || trackingstatus || ''><a href='' || trackingurl || ''>'' || trackingdate || ''</a></td>'' end from project_tracking where projectid= ''' || projectid || ''' {sql-query2}' from project {sql-query}An extra column generated between the projectName and the trackingdate.
Do you know what happened?
Thanks,
Carol
Oct 31, 2008
Bob Swift says:
Sorry, don't know, but I would not mix wiki and html. Does it work without the h...Sorry, don't know, but I would not mix wiki and html. Does it work without the html? Try the bgcolor macro instead of the html and see how that goes.
Nov 02, 2008
Carol Geng says:
Hi Bob, I changed to table=false and it is working fine now. Do you have an exa...Hi Bob,
I changed to table=false and it is working fine now.
Do you have an example how to have sql-query, sql-query1, sql-query2 work together?
I tested and the 3rd sql not run properly:
Table Project:
projectId projectName projectCategory
1 marketing1 marketing
2 engineering2 engineering
3 engineering3 engineering
Table project_tracking
projectId TrackingItem TrackingDate TrackingStatus TrackingURL
1 Advertising 12/02/2008 Green
1 Demo 12/05/2008 Red http://demo
2 Prototype 11/2/2008 http://waytogo
3 FinalTesting 12/15/2008 Red http://done
{sql-query:datasource=test|output=wiki|table=false} select projectCategory , '{sql-query1:table=false|datasource=test} select projectName , ''{sql-query2:table=false|datasource=test} select trackingDate from project_tracking where projectid= '''' || projectid || '''' {sql-query2}'' from project where projectCategory=''' || projectCategory || ''' order by projectid {sql-query1}' from project group by projectCategory {sql-query}Thanks,
Carol
Nov 02, 2008
Bob Swift says:
No. Your example pretty good though. You will have to debug each part separatel...No. Your example pretty good though. You will have to debug each part separately.
Nov 02, 2008
Carol Geng says:
Hi Bob, The 3rd query here doesn't run at all. window.SyntaxHighlighter.con...Hi Bob,
The 3rd query here doesn't run at all.
{sql-query2:table=false|datasource=test} select trackingDate from project_tracking where projectid= '''' || projectid || '''' {sql-query2}It looks the 2nd query closed its connection and it won't recognize the 3rd sql-query2 here.
would you help to check?
Many thanks,
Carol
Oct 30, 2008
Cody DeNiro says:
I am having a problem using the sql-query in conjunction with the chart macro. ...I am having a problem using the sql-query in conjunction with the chart macro.
I am trying to render a pie chart using a simple table. the table contains a product type and a count of each product (i.e. red, 4 - green, 49, yellow, 3)
For some reason the chart only shows the count of the last product. If i set the chart to bar type it works fine. Also if I set dataDisplay to true the table looks correct.
It could be an issue with the chart macro but maybe someone has an idea of how to fix it.
Here is the syntax
{chart:legend=true\|width=300\|height=200\|3D=true\|dataDisplay=before\|type=pie\|pieSectionLabel=%0% = %1%\|tables=content} {sql:dataSource=datasource\|id=content\|} select product as "Product", count as "Count" from install_base {sql} {chart}Oct 30, 2008
Bob Swift says:
Use dataOrientation=vertical on the chart macro. SQL produces rows of data and ...Use dataOrientation=vertical on the chart macro. SQL produces rows of data and chart defaults to horizontal data.
Oct 31, 2008
Cody DeNiro says:
Thanks Bob. That was the one variable I didn' tryThanks Bob. That was the one variable I didn' try
Nov 02, 2008
Carol Geng says:
Hi Bob, Do you have an example on how to use 'expandArray' feature? Thanks, C...Hi Bob,
Do you have an example on how to use 'expandArray' feature?
Thanks,
Carol
Nov 02, 2008
Bob Swift says:
No. You need a database table with an array field. A user wanted an option to ...No. You need a database table with an array field. A user wanted an option to display those types of fields.
Nov 20, 2008
Neil Arrowsmith says:
Hi Is there a particular reason that the SQL plugin won't work against Confluen...Hi
Is there a particular reason that the SQL plugin won't work against Confluence 2.5.1 (running inside a Jira 3.10.1 standalone server against an MS-SQL db if that matters)?
Or is it just that it has only been tested against 2.5.2+ ?
Thanks very much
neil
Nov 21, 2008
Bob Swift says:
It was tested on 2.5.2 and later releases. It may work, if not, get 3.3.0 versio...It was tested on 2.5.2 and later releases. It may work, if not, get 3.3.0 version of the plugin that worked on releases prior to 2.5.2. The plugin repository should give you the right version for your Confluence version.
Nov 24, 2008
Neil Arrowsmith says:
Thanks Bob. I can happily tell you tell that version 3.4.0 works fine against o...Thanks Bob.
I can happily tell you tell that version 3.4.0 works fine against our Confluence 2.5.1 install.
Nov 25, 2008
Shaikh Riyaz Ahmed says:
I am using confluence v2.9.2 along with Websphere v 6.1. I am using direct JDBC ...I am using confluence v2.9.2 along with Websphere v 6.1. I am using direct JDBC connection as there is known issue in websphere with oracle datasource. Refer CONF-3580.
How I can use this plug-in with direct JDBC connection.
Please let me know if there is any other way to achieve it.
Thanks
Nov 26, 2008
Bob Swift says:
It doesn't matter how Confluence accesses the database, the sql plugin needs dat...It doesn't matter how Confluence accesses the database, the sql plugin needs datasources defined to any database you want to query and, yes, one of them may be the same database that Confluence uses.
Dec 18, 2008
George Cowsar says:
We're running Confluence 2.9 (on a test server, more up to date on production wi...We're running Confluence 2.9 (on a test server, more up to date on production with 2.9.2)
We're having trouble getting this to work with a mysql database, not the confluence db, and not on the same host (verified the connection parameters with mysql client).
We get: sql-query: javax.naming.NamingException: Cannot create resource instance
What are we doing wrong?
In conf/server.xml we have: <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="reporter" password="our-secret-password" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://bubbles:3306/testdb?autoReconnect=true"/> and in WEB-INF/web.xml, we have <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/TestDS</res-ref-name> <res-type>javax.sql.Datasource</res-type> <res-auth>Container</res-auth> </resource-ref>Dec 18, 2008
George Cowsar says:
... I left out the macro that I was trying to execute window.SyntaxHighlight...... I left out the macro that I was trying to execute
{sql-query:dataSource=TestDS} select count(*) from TEST_USERS {sql-query}Dec 18, 2008
Bob Swift says:
Your macro is using TestDS while the configuration you have is TestDB. Also, I ...Your macro is using TestDS while the configuration you have is TestDB. Also, I don't know why you need the web.xml update.
Dec 19, 2008
George Cowsar says:
Now I get: sql-query: dataSource: TestDB not found The macro now refers to Test...Now I get: sql-query: dataSource: TestDB not found
The macro now refers to TestDB to match the resource name.
My hopes were up (even though I've tried all combinations I can think of), but no... still doesn't work.
BTW - I did remove the bit in web.xml and restart.
BTW #2 - I dunno why anything in web.xml either (wasn't mentioned in your initial instructions way way above), but after having it not work with many combinations of head banging attempts... thought I'd try something! There are several references to people discussing that (see above), and I couldn't find a complete example that is not the confluence database.
Dec 20, 2008
Bob Swift says:
Sorry you are still having problems. Please open an issue and include log infor...Sorry you are still having problems. Please open an issue and include log information (log should contain stack information from the exception you are seeing. You can get additional debug information in the log by adding the following to .../WEB-INF/classes/log4j.properties: log4j.logger.org.swift.confluence.sql=DEBUG.
Jan 05, 2009
Rwan says:
Hi Bob, We are facing an issue while trying to access our metrics page using S...Hi Bob,
We are facing an issue while trying to access our metrics page using SQL Plugin.
sql: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
select companyname,geo from customer_details
Kindle let me know what could be the root cause for this issue.
Datasource:<Resource
name="jdbc/confluence"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@my_db_server:1521:db_schema"
username="username"
password="password"
connectionProperties="SetBigStringTryClob=true"
maxActive="25"
maxIdle="5"
maxWait="10000"
/>
Thanks
Jan 06, 2009
Bob Swift says:
Increase your maxActive="25" setting. For instance, our installation uses 100. I...Increase your maxActive="25" setting. For instance, our installation uses 100. It will require a server restart.
Jan 07, 2009
Rwan says:
Yes, you are right. But what happens to that stale connection. How will I rectif...Yes, you are right. But what happens to that stale connection. How will I rectify that?
Say for eg:
If I increase maxActive="50" , then again at some point of time, the same problem will persist.
Is there any other way to overcome this issue? i.e., identify the stale connections and destroy
Jan 07, 2009
Bob Swift says:
Unused connections go back into the pool. But if there are already 25 active us...Unused connections go back into the pool. But if there are already 25 active users of the connection pool, the next request for a connection may delay or time out and fail. In your case, the connection pool needs to satisfy all of confluence requests. If you want, you can create another datasource to the same database so it is a separate pool.
Jan 07, 2009
Rwan says:
creating another datasource to the same database is not an advisable option. How...creating another datasource to the same database is not an advisable option. However we can increase the maxActive setting.
My question is,
When user clicks the metrics page( that contains the table displayed using SQL plugin), a connection established for that datasource.
What happens when the user close the browser or visit some other page using the same browser?? In this case whether the connection go back to the pool or it will remain as stale connection...
Jan 07, 2009
Andy Brook says:
The web container Confluence is running in provides access to databases through ...The web container Confluence is running in provides access to databases through datasources, the container is reponsible for pooling. We use Jboss4.2.2 as a container and the WAR confluence, its datasource definition XML file also permit the inclusion of check SQL 'check-valid-connection-sql tag' as well as a backgroun check period, and idle timeout period. If you can't set any of these kind of values in your container, it may explain stale connections. Figuring out how to monitor your connections would be the first step to trying to fix the problem.
Can't say much to the standalone version...
Jan 07, 2009
Bob Swift says:
The plugin closes the connection as soon as the query is done. As Andy mentions,...The plugin closes the connection as soon as the query is done. As Andy mentions, the container takes care of it from there including adding back to the pool.
Jan 14, 2009
Steve Seremeth says:
Solved the issue I reported earlier - the .csv I was importing into MySQL was im...Solved the issue I reported earlier - the .csv I was importing into MySQL was imperfect.
Jan 19, 2009
Kaustubha says:
Hi everybody, I am using confluence 2.2.1 and trying to install compatiable SQL...Hi everybody,
I am using confluence 2.2.1 and trying to install compatiable SQL plugin. but i am not able to get the appropriate plugin. Please help me with the plugin.
Jan 19, 2009
Bob Swift says:
Follow the link in the compatibility macro at the top of the page.Follow the link in the compatibility macro at the top of the page.
Jan 19, 2009
Brad Rubin says:
Hey all. We are using this plugin and find it very valuable for our busine...Hey all. We are using this plugin and find it very valuable for our business. From a security perspective, I am wondering if we can turn off the script functions that we do not want enabled for our wiki. For example, we don't want to expose or allow people to write raw sql queries in wiki pages. Instead, we want to control queries through a process and store them in files to use the #filename script within the SQL macro. Is it easy to configure teh jar file or the plugin to only allow this function of the plugin? If so, can you recommend the changes necessary? I appreciate any and all responses.
Jan 19, 2009
Bob Swift says:
Please write up an issue to get an improvement in the base. Likely just a macro ...Please write up an issue to get an improvement in the base. Likely just a macro security based changed to restrict. As a patch, you can comment out the sql = info.getMacroBody(); in SqlMacro.java and build.
Jan 19, 2009
Kaustubha says:
Hi, I have used SQL plugin 3.2.1 3.0 as well as 3.1. but&nbs...Hi,
I have used SQL plugin 3.2.1 3.0 as well as 3.1. but any of these are not compatiable for confluence 2.2.1
Please help me with this problem
Jan 20, 2009
Bob Swift says:
Then try previous version included in Scripting and External Content Macros. Oth...Then try previous version included in Scripting and External Content Macros. Other than that, you are on your own - only more recent versions are supported.
Jan 20, 2009
Richmond-rae Dalisay says:
Hi guys, I tried installing the plugin by following the guide but encountered pr...Hi guys,
I tried installing the plugin by following the guide but encountered problems.
Here's what I did:
When I tried to start it up, my confluence page didn't load.
Am I missing something?
Thanks om advance.
Jan 20, 2009
Frank Stiller says:
Hello Richmond-rae, i dont know where you found these steps, i would recommend n...Hello Richmond-rae, i dont know where you found these steps, i would recommend not to modify the confluence.cfg.xml if not forced to. For the SQL-Plugin to work you just have to add datasources to the server.xml as described on this Page. You dont have to modify any other configuration files.
Steps recommended:
As the sql-plugin does not use the confluence-connection you must add a datasource for it (which will run completely separate from the one in the confluence.cfg.xml) if you want to access your Wiki-data through it.
Jan 20, 2009
Richmond-rae Dalisay says:
Hi Frank, Thanks for the reply. Anyways, I tried what you say. Here are my foll...Hi Frank,
Thanks for the reply. Anyways, I tried what you say. Here are my followup questions:
By the way here is my sql macro code that I used:
{sql-query:dataSource=confluence|output=wiki} select * from users {sql-query}Am I missing something?
Thanks in advance.
Jan 20, 2009
Frank Stiller says:
I can only guess why he cant create a Instance of the Driver. Maybe you have cop...I can only guess why he cant create a Instance of the Driver. Maybe you have copied both jar-files to the lib, or you have forgotten to copy the new one there or maybe it is a typo like the : after mysql, see below, how i setup one of my Resource-URL:
If the problem persists try to analyse the log-file for more details.
Jan 23, 2009
Richmond-rae Dalisay says:
Hi Frank, I got it working already. Thanks for the help.Hi Frank,
I got it working already.
Thanks for the help.
Jan 23, 2009
Richmond-rae Dalisay says:
Hi Frank, I got it working already. Thanks for the help.Hi Frank,
I got it working already.
Thanks for the help.
Jan 20, 2009
Bob Swift says:
Good advice Frank! And I would add the linked instructions on this page state: C...Good advice Frank! And I would add the linked instructions on this page state:
Feb 05, 2009
Douglas Garstang says:
Hi All. I am running confluence 2.10.1, and I've been trying to get the SQLite ...Hi All.
I am running confluence 2.10.1, and I've been trying to get the SQLite plugin to work.
This is the error I get when I call the plugin from confluence:
{sql-query:dataSource=trac|output=wiki} select * from ticket where id=1013; {sql-query}Doug.
Apr 07, 2009
senthilkumar raju says:
Hi, I've installed the SQL-Plugin and had made changes to server.xml and web.xm...Hi,
I've installed the SQL-Plugin and had made changes to server.xml and web.xml as per the instructions given out in http://confluence.atlassian.com/display/CONFEXT/SQL+Plugin
I'm still unable to configure the page to use the SQL plugin because I'm unable to access the data source that I configured. I had infact tested out my configuration using http://confluence.atlassian.com/display/DOC/Troubleshooting+External+Database+Connections
I was able to test the database configuration successfully, but it errors out when i test the data source.
ERROR MESSAGE:
Connecting to database via Datasource:
Gain InitialContext?: ok
Locate Datasource (jdbc/ETDHub) in InitialContext?: Couldn't locate Datasource (jdbc/ETDHub).
Check your JNDI configuration:
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
Open a connection via Datasource (jdbc/ETDHub)? Couldn't open a connection on Datasource (jdbc/ETDHub): java.lang.NullPointerException
I've also created a JIRA incident under the SQL-Plugin project - SQL-53
Can you please advise me on the issue and to help rectify it
I'm getting the following error when using the SQL plugin on confluence:
sql-query: Unexpected program error: com.atlassian.renderer.v2.macro.MacroException: javax.naming.NamingException: Cannot create resource instance
select ric, smactiveflg from eq_gtick_pme_security_master where ric='IBM.N';
Apr 15, 2009
Thom Pantazi says:
I tried to install this plugin but it doesn't seem to be able to connect. I use...I tried to install this plugin but it doesn't seem to be able to connect. I used the same credentials as confluence is using but I keep gettin an error. I opened a JIRA ticket too but I am not sure if that is how I should report my problem.
Apr 28, 2009
Song Hong Hui says:
Hi Bob, I keep getting this error message on my 1st view on pages that contain ...Hi Bob,
I keep getting this error message on my 1st view on pages that contain this macro.
sql: Unexpected program error: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was93371 milliseconds ago.The last packet sent successfully to the server was 93371 milliseconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
Any idea what is the problem? thanks for the help.
May 11, 2009
Bjorn Andersson says:
Hi Bob, Would it be possible to allow user to iterate through the result set to...Hi Bob,
Would it be possible to allow user to iterate through the result set to be able to wrap the result, an individual field, in html for example? I'm creating a portal page where I am pulling in multiple projects in various phases to show a high-level status of everything, would like to be able to link to an individual project from there by dynamically creating a link to each project from the results much like I would do utilizing PHP, for example. If this is already possible, please point me in the right direction but if not...woudld be a nice feature to have.
Bjorn
May 18, 2009
Adam Gentry says:
Howdy Bob et al, So we are using the plugin to do some SQL documentation of our...Howdy Bob et al,
So we are using the plugin to do some SQL documentation of our sp's and views, which currently we handle by calling sp_helptext (Microsoft SQL Server command) to get the sql definition of the object.
It works great except we loose all of our formatting/whitespace.
For example in our database the script show up as:
CASE WHEN Column1 IN ('X', 'Y', 'Z')
THEN CASE WHEN Column2 = 0 THEN ABS(Column3)
ELSE ABS(Column4)
END
ELSE 0
but through the plugin it becomes the following on the wiki:
CASE WHEN Column1 IN ('X', 'Y', 'Z')
THEN CASE WHEN Column2 = 0 THEN ABS(Column3)
ELSE ABS(Column4)
END
ELSE 0
Not so pretty to read, especially if its a pretty long sp, so is there a way to show the formatting/padding?
This is how we are currently running the plugin:
sql:dataSource=OurDatabase|output=html|enableSorting=false|table=false
sp_helptext 'OurProcedure'
sql
Thanks in advance!
Adam