jdbc连接sqllite
import java.sql.*;
public class TestSQLite {
/**
* @param args
*/
public static void main(String args[])
{
try{
Class.forName("org.sqlite.JDBC");
Connection con = DriverManager.getConnection("jdbc:sqlite:G:\\zieckey.db");
Statement stat = con.createStatement();
stat.executeUpdate("drop table if exists jester");
stat.executeUpdate("create table jester(name varchar(20),salary int);");
//create table two row
stat.executeUpdate("insert into jester values('BEHOLD',200);");
stat.executeUpdate("insert into jester values('GIST',300);");
ResultSet rs = stat.executeQuery("select * from behold;");
while(rs.next())
{
System.out.print("name = "+rs.getString("name")+" ");
System.out.println("salary = "+rs.getString("salary"));
}
rs.close();
con.close();
}catch(Exception e){
e.printStackTrace();
}
}
}