aspose file tools
The moose likes JDBC and the fly likes Add batch (batch insertion into the database) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Add batch (batch insertion into the database)" Watch "Add batch (batch insertion into the database)" New topic
Author

Add batch (batch insertion into the database)

moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
hi all,

i'm trying to insert large number of rows to the database , about 100,000 record and i want to insert them every 35,000 record, when i fill the heap i success inserting about 34,000 record after that i fail .

any ideas ? any one understand what i'm trying to say !??!!

thanx in advance
[ July 04, 2005: Message edited by: moh sak ]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26499
    
  78

Moh,
My guess is you need more memory (or smaller batches.) Why not just commit after every 20,000 records?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1076

If transaction is an issue and you want to insert 100,000 records in your table then insert them in temp table using small batches then move data to master table.
Otherwise I will also prefer using smaller batches as Jeanne said

Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
moh sak
Ranch Hand

Joined: May 11, 2005
Posts: 78
hi all,

thanks for your replay i'll try it out and it must work since i'll devide the data into smaller chuncks

thanks very much
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Add batch (batch insertion into the database)
 
Similar Threads
SQLException. Generel Error
File I/O
Batch updation failure because of duplicate records
Inserting a record when the table has no primary key
java I/O