| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера