Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

cooL, it takes 14 seconds to insert 721 records to SQL Server 7.0  RSS feed

 
YuenLian Wu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

I just wrote a java program to read data from file and then insert to SQL Server. The file has 721 records ready to be inserted to database. The following is the program


I didn't show my other classes since I believe you guys can understand what I try to do in the above. By executing the above program, it takes about 14 seconds to import 721 files to the SQL Server. Is that normal ? How can I optimize my code and performance ? Any nice suggestion?

THanks in advance

Transistor

[ February 10, 2006: Message edited by: YuenLian Wu ]
[ February 10, 2006: Message edited by: YuenLian Wu ]
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you timed how much of that time is spent doing the actual update, and how much is spent in the rest of your Java code?
You could also correlate the client timings with the DB logs to see if there is a really slow network connection in between.
Maybe there are a lot on indexes on the table that need to be updated whenever a row is inserted?
Maybe batchsize is 1?
 
Paul Clapham
Sheriff
Posts: 22503
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by finding out which parts of the code take the most time.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!