I have managed the following with an external PostgreSQL server:
Retrieve and display queried data in a page with Groovy;
Write a Java component to perform query, call and display with Groovy or Velocity;
Generate JSON data of query results with Groovy, call and display from LiveTable.
Happy to share but not near my computer till later today, so let me know which of the
above is closest to what you want to do and I'll post something when I can.
----- Reply message -----
From: "Jason Clemons" <jason.clemons(a)live.com>
To: "Xwiki Users" <users(a)xwiki.org>
Cc: "Clemons Jason" <jason.m.clemons(a)aexp.com>
Subject: [xwiki-users] Query external MSSQL DB in a wiki page
Date: Tue, Dec 9, 2014 08:26
Hello,
Can anyone point me in the right direction? I'm trying to query and external
Microsoft SQL database from a wiki page. My current wiki runs on MSSQL just fine using
sqljdbc4.jar configured with hibernate. The DB I want to query is actually on the same
server, I can actually make it appear in the same DB if that makes things easier.
I've looked at SQL Tools extension -->
http://extensions.xwiki.org/xwiki/bin/view/Extension/SQL+Tools and I can get that to work
just fine even querying the other database, but I don't know how to make the results
of a query from that tool appear in a separate page I've created for use in Velocity
for example.
I've tried to get the example on the "Execute SQL" page here -->
http://extensions.xwiki.org/xwiki/bin/view/Extension/Execute+SQL to work but I get a
Groovy error on the second snippet and nothing at all appears on the page using the first
snippet (but no error).
I've also looked at this plugin -->
http://xwikisql.gradsoft.ua/docs/XWikiSqlPluginGuide.html but it hasn't been updated
since 2008, so I'm not really sure that's a good idea from a sustainability
perspective in a production environment.
Ultimately, I will have a flat table in some database, really any database (e.g..it can be
the XWIKI DB)..and I need to be able to get the rows and columns from the table and expose
them as an HTML table in my wiki page. Once I figure out how to get the data making it
into a table is easy enough, but I can't even figure out how to get an object or array
with the data in it to iterate.
All help is greatly appreciated.
Thanks in advance,
Jason