Re: Strange behavoir of batches
От | Angelo Neuschitzer |
---|---|
Тема | Re: Strange behavoir of batches |
Дата | |
Msg-id | 43267ACC.1020307@jenomics.net обсуждение исходный текст |
Ответ на | Re: Strange behavoir of batches (Oliver Jowett <oliver@opencloud.com>) |
Список | pgsql-jdbc |
Yes, I know, I found the problem for me already. If one does call addBatch() every time it works fine. But thats not the point. If I don't do it (there should be 1 line missing each block) but fiddle around with the second block { // original insert 82 rows (in table B) 2 (in table C) 9 (in table D) { { // changed 2 (in table C) 9 (in table D) 82 (in table B) { it works well... Also It should not matter at all what is in tables B,C and D if I enter a reference from A to E... but it seems that it does. If got some minutes free I'll go and get the old code again to reproduce some things and write a report. Zo Phar Angelo Neuschitzer Oliver Jowett wrote: >Angelo Neuschitzer wrote: > > > >>>PreparedStatemet pStmt = con.prepareStatement("INSERT INTO table_a >>>VALUES (...)"); >>>for(0 to 93) >>>{ >>> [fill values into pStmt] >>> if(not last row) >>> { >>> pStmt.addBatch(); >>> } >>>} >>>pStmt.executeBatch(); >>>pStmt.clearBatch(); >>> >>> > >AFAIK, this "not last row" logic seems wrong. Calling executeBatch() >only executes those queries that have been added to the batch via >addBatch(), so the loop will lose the last INSERT. > >-O > > > > -- Angelo Neuschitzer Development Java. Mit Sicherheit. Jenomics GmbH, Thalkirchnerstraße 55, 80337 München, Deutschland www.jenomics.de an@jenomics.de Tel: +49 (0) 89 767 59 003; Fax: +49 (0) 89 767 59 005 ------------------------------------------------------ Diese Nachricht enthält vertrauliche Informationen und ist ausschließlich für den Adressaten bestimmt. Der Gebrauch durch Dritte ist verboten. Jenomics ist nicht verantwortlich für die ordnungsgemäße, vollständige oder verzögerungsfreie Übertragung dieser Nachricht. This message may contain confidential information and is intended solely for the use by the addresse. Use of this communication by others is prohibited. Jenomics are neither liable for the proper and complete transmission of the information in this message nor for any delay in its receipt.
В списке pgsql-jdbc по дате отправления: