I’m developing a program to move database from some other DBMS database to a derby database. To accomplish this I’m making a java application and implementing batch prepared statements. The batch is very large (13000+ statements). When the program runs I receive this exception:
Caused by: java.lang.NullPointerException
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeBatchElement(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeBatch(Unknown Source)
The PreparedStatement object used to execute the batch is not null. Also, by querying the destination database after the program ran, I noticed that all of the rows that I had desired to move, had been moved. Doing some debugging I noticed that the Vector<E> batchStatements which is a member of the PreparedStatements object, had extra elements, A LOT of them. 13171 elements were populated and 7309 elements were null. I observed similar behavior with a smaller set of batchesand I am pretty sure this is typical vector behavior. However, I do not receive the above exception when using smaller batches. Such as 10 statements. I suppose a work around for now is to do smaller set of batches. Is this a known limitation of derby? Any idea why this may be happening?