In my Groovy script, I have following structure:
def sql = Sql.newInstance(connString, "user", "password",
"org.postgresql.Driver")
sql.withTransaction {
sql.withBatch(){}
sql.withBatch(){}
sql.withBatch(){}
.........
}
sql.close()
I want to take care of timeout issues here.
But Sql API doesn't have any method for it.
So how can I do it? I am using PostgreSQL driver.
I came across this. But I get error:
java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc4.Jdbc4Connection.setNetworkTimeout(Executor, int) is not yet implemented.
PS:
int[] modifyCount = sql.withBatch(batchSize, updateQuery) { ps ->
keyValue.each { k,v ->
ps.addBatch(keyvalue:k, newvalue:v)
}
}
In above code, when I try to add ps.setQueryTimeout(), error message says no such method defined.