// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;

public class InsertAfter5 {
    public static void main(String[] args) throws Exception {
        Class.forName("org.sqlite.JDBC");
        Connection con = DriverManager.getConnection("jdbc:sqlite:address.db");
        PreparedStatement pstmt = con.prepareStatement("INSERT INTO address VALUES(?,?,?)");
        Address addr;
        addr = new Address(13, "M M", "M Road 1313");
        pstmt.setInt(1, addr.getId());
        pstmt.setString(2, addr.getName());
        pstmt.setString(3, addr.getAddress());
        pstmt.executeUpdate();
        addr = new Address(14, "N N", "N Road 1414");
        pstmt.setInt(1, addr.getId());
        pstmt.setString(2, addr.getName());
        pstmt.setString(3, addr.getAddress());
        pstmt.executeUpdate();
        pstmt.close();
        con.close();
    }
}
