Been playing around with a hosted Oracle database that *seems* to be
dropping connections. I made the following script to test (call to
Sql.newInstance() not shown) but I'm curious -- does Groovy create the
connection to the database on newInstance(), or every time eachRow() is
called?
--- Example Code ---
String query = "select count(*) cnt from spriden where
upper(spriden_last_name) = 'STURGILL'"
int minuteDelay = 0
while (minuteDelay <= 120) {
Thread.sleep(1000 * 60 * minuteDelay); // Sleep increasing number of
minutes
Date date = new Date();
sql.eachRow(query) {
println "After ${minuteDelay} minutes - ${it.cnt} (${date})"
}
minuteDelay += 5;
}
--- End Example ---
Thanks so much you wonderful programmers!