db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: Problems with very large Batch Prepared Statements
Date Thu, 06 Sep 2012 11:23:51 GMT
On 9/4/12 4:11 PM, Alain Kuchta wrote:
>
> Hi all,
>
> 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)
>
> at com.etegent.tools.SqlDataTransferTool.SqlDataMover.transferTable( 
> SqlDataMover.java:207 )
>
> 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?
>
> -Thanks
>
> Alain Kuchta
>
Hi Alain,

A NullPointerException is definitely a Derby bug. If you can script this 
problem and log a JIRA, we should be able to fix it.

Another approach to bulk-importing data is to wrap your access to the 
other database in a ForeignTableVTI (see 
https://issues.apache.org/jira/browse/DERBY-4962).

Hope this helps,
-Rick

Mime
View raw message