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
--
View this message in context:
http://www.nabble.com/Sample-Groovy-Code-tf4717685.html#a13486121
Sent from the XWiki- Users mailing list archive at
Nabble.com.