Sure.
On Sun, Jul 31, 2016 at 1:50 PM, GroovyBeginner
wrote:
> Can I achieve this xml output directly after querying to the db?
>
>
>
> --
> View this message in context:
> http://groovy.329449.n5.nabble.com/Convert-Oracle-Result-sets-to-xml-tp5734358p5734375.html
> Sent from the Groovy Dev mail
I was trying to create the list initially in that case and then to xml with
the following code
import groovy.sql.Sql;
import java.sql.ResultSet;
Sql sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1521:XE","username",
"password", "oracle.jdbc.driver.OracleDriver")
def emptyList = []
sql.e
You probably want to call toRowResult():
@Grab('org.hsqldb:hsqldb:2.3.2')
@GrabConfig(systemClassLoader=true)
import groovy.sql.Sql
def sql = Sql.newInstance('jdbc:hsqldb:mem:MyDb', 'sa', '',
'org.hsqldb.jdbcDriver')
sql.execute '''
DROP TABLE MyTable IF EXISTS;
CREATE TABLE MyTable (
i