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