I am writing a simple application using SQLite as the database.
Everything works fine except there is an update that is not working at
all.  Here is the ddl for the table and the java code I am using to
make the update.  Can anyone please tell me what I am doing wrong.

DDL
create table oncall_contact(ID integer primary key, Person
varchar(150), Phone varchar(50), Email varchar(150));

Java Code
        StringBuffer updateString = new StringBuffer();

        updateString.append("update oncall_contact set ");
        updateString.append("Phone = ?, ");
        updateString.append("Email = ? ");
        updateString.append("where ID = ?;");

        System.out.println("saving database");

        Connection conn =
DriverManager.getConnection("jdbc:sqlite:oncalllist.db");
        PreparedStatement stmnt =
conn.prepareStatement(updateString.toString());

System.out.println(updateString.toString());

        for  (Entry<Integer, Integer> rowInfo :
modifiedRows.entrySet()) {
            int rowNum = rowInfo.getKey().intValue();

            System.out.println("rowNum " + rowNum);

                ContactRecord record = data.get(rowNum);

                System.out.println(record.toString() + " " +
record.getColumnData(ContactRecord.PHONE));

            stmnt.setString(1,
record.getColumnData(ContactRecord.PHONE));
            stmnt.setString(2,
record.getColumnData(ContactRecord.EMAIL));
            stmnt.setString(3,
record.getColumnData(ContactRecord.ID));
            stmnt.addBatch();
        }

        conn.setAutoCommit(false);
        stmnt.executeBatch();
        conn.commit();
        conn.close();

        modifiedRows.clear();

        System.out.println("finished saving");

Row number returned is correct, that has been verified.  Correct
ContactRecord has been retrieved from list.

-- 
Mailing List: http://groups.google.com/group/sqlitejdbc?hl=en
To unsubscribe, send email to [email protected]

Reply via email to