Hello Vincent, I've found out QueryPluginApi from the docs. But even if this is the API you meant, why is it not possible to use Groovy to access the database of my choice to display my data ? Harikrishnan vmassol wrote:
Hi,
Don't call the database directly. XWiki offers API for doing this.
What tutorial are you referring to?
Thanks -Vincent
On Oct 30, 2007, at 11:53 AM, V. Harikrishnan Nair wrote:
Hi all...
I am learning how to read from the default xwiki database xwiki_db using groovy. This is the code I got from the tutorial ->
------------- import groovy.sql.Sql sql = Sql.newInstance("jdbc:jtds:sqlserver://serverName/dbName- CLASS;domain=domainName", "username", "password", "net.sourceforge.jtds.jdbc.Driver") sql.eachRow("select * from tableName", { println it.id + " -- ${it.firstName} --"} ); ------------
This is the code which is edited by me ->
----------- import groovy.sql.Sql sql = Sql.newInstance("jdbc:jtds:sqlserver://localhost/xwiki_db- CLASS;domain=domainName", "sa", "", "net.sourceforge.jtds.jdbc.Driver") sql.eachRow("select * from XWIKIDOC", { println it.id + " -- $ {it.firstName} --"} ); ----------
Can anyone please rectify any errors here ? Especially the closure in the third line as I don't know the fields present in XWIKIDOC table...
Thanks, Harikrishnan
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- View this message in context: http://www.nabble.com/Sample-Groovy-Code-tf4717685.html#a13502522 Sent from the XWiki- Users mailing list archive at Nabble.com.