groovy基本mysql查询代码

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

package com.hongyuan.db

import groovy.sql.Sql

class DB {

	static main(args) {
		//创建查询对象
		def sql=Sql.newInstance("jdbc:mysql://localhost:3306/test",
								"root","123456","org.gjt.mm.mysql.Driver");
		//执行查询并处理结果					
		sql.eachRow("select ename from emp"){
			println it.ename;
		}
	}

}