Practically Groovy: JDBC programming with Groovy

Practically Groovy: JDBC programming with Groovy

import groovy.sql.Sql
class GroovySqlExample1{
static void main(String[] args) {
def sql = Sql.newInstance("jdbc:mysql://localhost:3306/words", "words",
"words", "com.mysql.jdbc.Driver")
sql.eachRow("select * from word"){ row ->
println row.word_id + " " + row.spelling + " " + row.part_of_speech
}
}
}

原文地址:https://www.cnblogs.com/lexus/p/2584650.html