Questions tagged [groovy-sql]

GroovySql is an API for the Groovy programming language

GroovySql uses closures and iterators to shift the burden of JDBC resource management from the developer to the Groovy framework.

27 questions
0
votes
0 answers

HikariPool is stuck with simple repository test via Groovy sql and Spock

In my Spring Boot application, I am writing Groovy Spock tests where I test my repository class if it can really insert data into the table via connecting to a real database. Config class: @Configuration @ComponentScan @EnableAutoConfiguration class…
victorio
  • 6,224
  • 24
  • 77
  • 113
0
votes
1 answer

How does groovy's addBatch(map) work for Sql.withBatch?

I'm trying to call groovy.sql.Sql.batch from a statically typed language. I succeed in calling addBatch on the callback object ps with a parameter of type List. This works well for statements like insert into TABLENAME(a, b, c) values (?, ?, ?). To…
Frank Neblung
  • 3,047
  • 17
  • 34
0
votes
2 answers

Not able to retrieve record using eachRow method

I am using below groovy code to select a row with a given username and password from mysql db. For example, I am searching for below user. Password is stored in db as a SHA1 hashed password. Name - test7 password -…
Karan Nayyar
  • 666
  • 2
  • 7
  • 14
0
votes
1 answer

How to create new SQL instance in groovy using secure DB2 z/OS connection?

I am groovy beginner with minimal java knowledge. Trying to access DB2 z/OS from groovy script. With not secure connection below sample works fine for me: import java.sql.*; import groovy.sql.Sql // DB2 sql = Sql.newInstance(…
0
votes
1 answer

Groovy convert sql.eachRow results to List

def List_Sftp = sql.eachRow(SftpQuery){ row -> if(row[4]=="SFTP") { def names= row.collect{ "${row[0]},${row[1]} ${row[3]} ,${row[4]},${row[5]},${row[6]},${row[7]}" } println names } if(row[4]=="ROSETTANET"){ …
0
votes
1 answer

Spring Boot app that uses Groovy for JDBC

I have spring-boot application that exposes ReST APIs. I am considering offloading all SQL reads to Groovy SQL. The DataSource is configured in Spring. I would like Groovy to use this DataSource. Btw, there will be multiple DataSource objects…
Sree
  • 746
  • 6
  • 21
0
votes
1 answer

Groovy Sql Execute Statement won't accept closures

I have a statement: sqlInstance.execute(executeString){ dummy, realList-> debug("Real LIst: "+realList) } which fails with 'Invalid column type' But: def bool =…
James.Wyst
  • 859
  • 3
  • 8
  • 13
0
votes
0 answers

Groovy SQL with dynamic insert

I'm writing a groovy script to archive data from a table of live database to an archive database (schemas). at present the table structure is same in both database schemas. that might get changed by adding new columns to the live table later based…
Nomesh DeSilva
  • 1,649
  • 4
  • 25
  • 43
0
votes
1 answer

'ORA-00911: invalid character' when SQL statement has semi-colon in the middle of the string

Has anyone encountered java.sql.SQLSyntaxErrorException: ORA-00911: invalid character when making sql.execute('...') (1) call with SQL statement that has ';' (semi-colon) characters in the middle of it. I'm aware that trailing semi-colon causes…
0
votes
1 answer

Groovy SQL Child Collection Persistence

I've got a class set up kind of like this: class ParentClass{ // Some other fields Set children } I'm wanting to use groovy.sql.Sql to keep the related ChildClass objects appropriately persisted in relationship to the…
Jason Lowenthal
  • 790
  • 1
  • 5
  • 16
0
votes
1 answer

'AST not available' exception while filtering DataSet

I have following groovy program - def people = sql.dataSet('players') def d = people.findAll { true } print d.rows() I get an exception at the print statement. groovy.lang.GroovyRuntimeException: DataSet unable to evaluate expression. AST not…
Kshitiz Sharma
  • 17,947
  • 26
  • 98
  • 169
0
votes
1 answer

The right way to prepare SQL statements with parametrized text search

Suddenly I've realized that while this works in groovy just like it is expeceted: Sql.newInstance(connectionParams).rows("SELECT FROM ITEMS WHERE id = ?", [200]) this won't work Sql.newInstance(connectionParams).rows("SELECT FROM ITEMS WHERE name…
shabunc
  • 23,119
  • 19
  • 77
  • 102
1
2