Connect to a MySQL database

Simple snippet for a connection to a MySQL database.


def sql = Sql.newInstance('jdbc:mysql://localhost:3306/test', 'root', '', 'com.mysql.jdbc.Driver')
	sql.eachRow('show tables'){ row ->
		println row[0]
	}

You will need the mysql driver jar in your classpath.