executeBatch (JDBC 2.0) and odd deadlocking w/ sql server
From: william milbratz (milbratz_at_hotmail.com)
Date: 04/20/04
- Next message: Jim: "jboss to postgresql connections fail. Failed to register driver"
- Previous message: Thomas Kellerer: "Re: sql92 entry level open source (stable) java database"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 20 Apr 2004 08:19:13 -0700
Hi,
I'm seeing an odd deadlocking problem when using jdbc 2.0
'executeBatch' calls w/ Microsoft Sql server 2000. The same code
executes fine on Oracle. It's difficult to find documentation
describing the low-level locking w/ jdbc executeBatch(); hence the
newsgroup post.
tech stuff:
-we're using Sql server 2000 SP3
-we're using the MS sql server jdbc drivers dated from 2002-04-19
(i.e. class dates on files in msbase.jar).
The scenario:
-one transaction deletes "a bunch" of records and inserts "another
bunch"
-two separate callable statements, executed via 'addBatch' and
'executeBatch' perform the deletes and inserts respectively
-sql server produces a deadlock error when two different processes are
updating two entirely different sets of records. A trace shows that
the "deadlocking" procedure calls have different input
parameters---i.e. similar procedures (and thus tables) but very
different record sets.
It thus appears that sql server is using 'page level' or 'table level'
locking in this case.
Additionally, this is definitely not a 'classic deadlock' (i.e. as in
'deadly embrace' as:
a) these are different record sets and
b) the procedures are all updating the records in the same sequence
order.
A co-worker wrote:
"I read that there is a separate exclusive lock for bulk updates - not
sure if this means 'bulk loader only' or whether it could also be for
batch executes."
My question:
What causes this deadlock? How can I prevent it?
thanks and best regards,
bill milbratz
- Next message: Jim: "jboss to postgresql connections fail. Failed to register driver"
- Previous message: Thomas Kellerer: "Re: sql92 entry level open source (stable) java database"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|