Output is:
~$ groovy conn.groovy
Users: 13
~$
@GrabConfig(systemClassLoader=true ) | |
@Grab("mysql:mysql-connector-java:5.1.40") | |
import groovy.sql.Sql | |
def sql = Sql.newInstance("jdbc:mysql://localhost:3306/test", "root", "root", "com.mysql.jdbc.Driver") | |
def users = sql.rows("SELECT * FROM users") | |
println "Users: ${users.size()}" |