transaction abortion

Поиск
Список
Период
Сортировка
От Michele Laghi
Тема transaction abortion
Дата
Msg-id 3F67506D.30404@swissinfo.org
обсуждение исходный текст
Список pgsql-general
Hi,
I am faced to the following problem:
...
conn.setAutoCommit(false);
String[] val = new String[] {"one", "two", "two", "three" };
for (int i=0; i < nmax; i++) {
    try {
       PreparedStatement
          pst = conn.prepareStatement("INSERT INTO ATEST VALUES (?)");
       pst.setString(1, val[i]);
       int ret = pst.executeUpdate();
    }
    catch (SQLException ex) { /* handle exception here */ }
}
conn.commit();
...

The inserted element is a primary key. What I want is to ignore the
insertion of entries which are already in the DB. This works fine with
Oracle and hsqldb but with Postgres the SQLException implicitly aborts
the transaction. Is this behaviour correct or is it a bug ?
If it is correct, is there a way to inhibit the abortion of the
transaction ? I am using v. 7.3.2 and as a driver jdbc7.2dev-1.2.jar

Regards
Michele


В списке pgsql-general по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: Red Hat 9 Postgres
Следующее
От: "Darko Prenosil"
Дата:
Сообщение: Re: Red Hat 9 Postgres