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
}
}
}

你可能感兴趣的:(programming)