Re: JDBC behaviour

Поиск
Список
Период
Сортировка
От Sridhar N Bamandlapally
Тема Re: JDBC behaviour
Дата
Msg-id CAGuFTBWODgA_-JLGWBHqg_2NUZWDiKZSUkNgFJj_CZ4gZcqjVQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: JDBC behaviour  (John R Pierce <pierce@hogranch.com>)
Ответы Re: JDBC behaviour
Re: JDBC behaviour
Список pgsql-jdbc
The code/framework is written to handle batch inserts, which is common for all databases

I feel, PostgreSQL JDBC may need to modify setAutoCommit(false) code to "implicit savepoint - on error - rollback to savepoint"



On Thu, Feb 18, 2016 at 3:59 PM, John R Pierce <pierce@hogranch.com> wrote:


if you want each insert to work indepedently yet stay with the transaction model, then each insert should be its own transaction...


    conn.setAutoCommit(false);
    executeUpdate("insert into employee(id,name) values(1, 'K1')"); conn.commit();
    executeUpdate("insert into employee(id,name) values(1, 'K1')"); conn.commit();
    executeUpdate("insert into employee(id,name) values(1, 'K2')"); conn.commit();

otherwise the way you wrote it, its a single transaction.   all three inserts have to succeed, otherwise, all three are rolledback.    why is that so hard to understand?


--
john r pierce, recycling bits in santa cruz



--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: JDBC behaviour
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: JDBC behaviour