Java program failing to update PostgreSQL database

时间:2016-07-11 20:04:59

标签: java postgresql psql

I have a Java program that uses prepared batch statements to update a PostgreSQL database.

System.out.println(_prepared);
int[] _results = _prepared.executeBatch();
for (int _x : _results) {
    System.out.println(_x);
}

The Java documentation for java.sql.Statement.executeBatch() states that for the elements in the array returned, "A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution".

It was working fine until earlier today. Now, when called on e.g. a single statement batch, it still indicates success with 1 row affected:

INSERT INTO participationrewarddatum (anonymized, deviceid, hashcode, id, participation, timestamp) SELECT NULL, '9AE8EE08-0AF1-44B1-8488-E64AA53E4E9C', NULL, 'e1285a4b-6e62-4728-919f-fd9ae7507975', 0.286576152, '2016-6-22 17:24:34.000000 -4:0:0'
1

But when I do SELECT * FROM participationrewarddatum; from psql, it reports an empty table.

I feel like I'm overlooking something simple?

0 个答案:

没有答案