1. 线下载最新的sqlite-jdbc-3.15.1.jar包,可以到这里下载:http://download.youkuaiyun.com/detail/likesidehu/9676062
2. 把jar包导入工程后就可以使用了.
3.简单实现代码:
def initSQLite() { def sql = Sql.newInstance("jdbc:sqlite:sample.db", "org.sqlite.JDBC") sql.execute("drop table if exists person") sql.execute("create table person (id integer, name string)") def people = sql.dataSet("person") people.add(id:1, name:"leo") people.add(id:2,name:'yui') sql.eachRow("select * from person") { println("id=${it.id}, name= ${it.name}") } }4.输出结果:
id=1, name= leo
id=2, name= yui