wood burning stoves 2.0*
The moose likes JDBC and the fly likes most efficient way to insert records in a DB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "most efficient way to insert records in a DB" Watch "most efficient way to insert records in a DB" New topic
Author

most efficient way to insert records in a DB

JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 48
hi guys,

I'm using the PreparedStatements's executeUpdate method. But sometimes there are blockings that occur in SQLServer that prevent the record from being inserted...

What is the most efficient way of inserting records in MS SQL 2000?
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

are you updating records or inserting?
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

Order your all of you inserts/updates in a single transaction to always update all tables in a specific order (for example, always update table A before table B, table B before table c, etc for all transactions). This prevents locking due to cycles.

Many times though, such ordering is difficult to implement.


My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: most efficient way to insert records in a DB