Prepared statement: java.sql.BatchUpdateException: Internal Error: oracle.j

Hi, im using a batch to insert a lot query's.

It works fine when i insert just a few records(2 000)

But now I tried to insert a little bit more (20 000), And then I get the following error:

java.sql.BatchUpdateException: Internal Error: oracle.jdbc.kprb.KprbDBStatement@44a41a86.

I guess it has something to do with the max a batch can hold.

I searched the internet for the max records a batch can hold, but i didn't find anything.

How can I solve my problem to insert 20 000 records?

[530 byte] By [klaasdea] at [2007-11-27 6:00:12]
# 1
Put them into more than one batch. If 2000 records in a batch works in your environment then use batches of 2000 records.
DrClapa at 2007-7-12 16:38:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

If you use OraclePreparedStatement you can set batch size and oracle driver automatically flushes the records into DB when it reaches batch size.

If you use standard JDBC PreparedStatement records keep added in client side unless you execute it. It would be better once your batch size reaches 100(depends on your data size, oracle recoments less than 40) clear the batch by executing PreparedStatement.

jmos30a at 2007-7-12 16:38:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
> How can I solve my problem to insert 20 000 records?If it was me I would use the oracle import tools rather than java. That method would be substantially faster and eliminates all java problems.
jschella at 2007-7-12 16:38:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
Thanks all,I made the max batch size 2.000 and now it's working great.And I don't think that oracle import tools will be much faster. Because I use a Java Stored Procedure. So the code is running on the database itself.
klaasdea at 2007-7-12 16:38:03 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...