Strange executing batch

From: Ilya Bulatov <i_il(at)mail(dot)ru>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Strange executing batch
Date: 2003-08-12 13:16:57
Message-ID: 738343455.20030812201657@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi , pgsql-jdbc.

How jdbc driver works with batch in one transaction all added
statement or each statement in individual transaction?

Class.forName("org.postgresql.Driver");

Connection c = DriverManager.getConnection("jdbc:postgresql:....");

PreparedStatement p = c.prepareStatement("insert into test(test) values(?)");
c.setAutoCommit(false);
for (int i = 0; i < 1000; i++) {
p.setString(1, "test"+i);
p.addBatch();
}

p.executeBatch();

If at executing executeBatch() on 500 statement error is arised ,that
for some reason first 499 statement are committed.

--
Truly yours,
Ilya mailto:i_il(at)mail(dot)ru

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message srikanth nagaraju 2003-08-12 14:02:27 FW: FW: pgsql - query
Previous Message zy7111 2003-08-12 12:34:39 Re: Character Decoding Problems