Here you can find the source of modify(String sql)
public static void modify(String sql)
//package com.java2s; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; public class Main { private static String default_db_name = "data"; public static void modify(String sql) { Connection conn = getConnection(null); Statement st = null;/*from w w w. j a v a2 s.c o m*/ try { st = conn.createStatement(); st.execute(sql); } catch (Exception e) { e.printStackTrace(); } finally { close(conn, st, null); } } public static void modify(String[] sqls) { Connection conn = getConnection(null); Statement st = null; try { if (sqls != null) { conn.setAutoCommit(false); st = conn.createStatement(); for (String sql : sqls) { st.addBatch(sql); } st.executeBatch(); conn.commit(); } } catch (Exception e) { e.printStackTrace(); } finally { close(conn, st, null); } } public static Connection getConnection(String dbFilePath) { Connection conn = null; try { if (dbFilePath == null || "".equals(dbFilePath.trim())) { dbFilePath = default_db_name; } Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:" + dbFilePath); } catch (Exception e) { e.printStackTrace(); } return conn; } private static void close(Connection conn, Statement st, ResultSet rs) { try { if (rs != null) { rs.close(); } if (st != null) { st.close(); } if (conn != null) { conn.close(); } } catch (Exception e) { e.printStackTrace(); } } }