SQLITE是一个轻型的数据库,广泛应用与嵌入式系统当中,支持多种开发语言,C, PHP, Perl, Java, C#,Python。它有体积小,效率高,可移植性好的优点
SQLite及sqlite-jdbc下载地址:见附件
JAVA-DEMO

Java代码 SQLITE使用指南 _指南 SQLITE使用指南 _指南_02
  1. public class Test {
  2. public static void main(String[] args) throws Exception {
  3. Class.forName("org.sqlite.JDBC");
  4. Connection conn =
  5. DriverManager.getConnection("jdbc:sqlite:demo.db");
  6. Statement stat = conn.createStatement();
  7. stat.executeUpdate("drop table if exists people;");
  8. stat.executeUpdate("create table people (name, occupation);");
  9. PreparedStatement prep = conn.prepareStatement(
  10. "insert into people values (?, ?);");
  11.  
  12. prep.setString(1, "Gandhi");
  13. prep.setString(2, "politics");
  14. prep.addBatch();
  15. prep.setString(1, "Turing");
  16. prep.setString(2, "computers");
  17. prep.addBatch();
  18. prep.setString(1, "Wittgenstein");
  19. prep.setString(2, "smartypants");
  20. prep.addBatch();
  21.  
  22. conn.setAutoCommit(false);
  23. prep.executeBatch();
  24. conn.setAutoCommit(true);
  25.  
  26. ResultSet rs = stat.executeQuery("select * from people;");
  27. while (rs.next()) {
  28. System.out.println("name = " + rs.getString("name"));
  29. System.out.println("job = " + rs.getString("occupation"));
  30. }
  31. rs.close();
  32. conn.close();
  33. }
  34. }