PreparedStatement.executeBatch() error? 7.3
От | Jeremiah Jahn |
---|---|
Тема | PreparedStatement.executeBatch() error? 7.3 |
Дата | |
Msg-id | 1044655282.1848.506.camel@bluejay.goodinassociates.com обсуждение исходный текст |
Ответы |
Re: PreparedStatement.executeBatch() error? 7.3
Re: PreparedStatement.executeBatch() error? 7.3 |
Список | pgsql-jdbc |
The following code doesn't work, but if in place of doing an addBatch loop with an executeBatch(), I do an executeUpdate each time it does work. I get a parse error from the db server: ERROR: parser: parse error at or near "'1998CF43'" at character 4202 this corresponds to the first value. I'm using the jdbc3 jar for this. PreparedStatement pStatement = connection.prepareStatement("insert into case_data_store values (?,?,?,?)"); ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); for (int current_chunk = 0; current_chunk < chunk_count; current_chunk++){ pStatement.setString(1,values.get("CASENUMBER").toString()); pStatement.setString(2,values.get("NCIC").toString()); pStatement.setInt(3,current_chunk); pStatement.setBytes(4,baos.toByteArray()); pStatement.addBatch(); //pStatement.executeUpdate(); } pStatement.executeBatch(); This is the stack trace: java.lang.ArrayIndexOutOfBoundsException: 1 at org.postgresql.core.QueryExecutor.sendQuery(QueryExecutor.java:143) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:65) at org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:451) at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:281) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:179) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:165) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:80) -- Jeremiah Jahn <jeremiah@cs.earlham.edu>
В списке pgsql-jdbc по дате отправления: