Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / February 2005

Tip: Looking for answers? Try searching our database.

Deadlock on MS-SQLServer

Thread view: 
Silvio Bierman - 01 Feb 2005 23:30 GMT
Hello all,

I have an application that uses a connectionpool with connections to
SQLServer2000 through the MS JDBC driver, current version.

The writes are very basic and so they are mostly done in autocommit mode. In
one location where a set of rows read from a tabular source like Excel are
updated-by-id or inserted when not found. In a second table a record is
inserted also for each row inserted in the primary table. To find the
foreign key a select on the primary table is performed first.

All selects, updates etc. are using the same connection. Recently we decided
to speed up the process by setting the connection to autocommit(false) and
doing a commit() for each K records and at the end of the process.

To our surprise one server (obviously not one of our own but one of our
clients) started suffering from deadlocks. It was completely up to date and
had all service packs installed (some of ours didn't, some did). We backup
up the databse and restored it on one of our servers. Off course, the
problem could not be reproduced.

I decided to revert to autocommit mode and the problems disappeared.

Does anyone have an idea of what could cause this behaviour?

Running the same code on Oracle and MySQL showed no problems, BTW.

Regards,

Silvio Bierman
Joe Weinstein - 02 Feb 2005 00:00 GMT
Hi. It's difficult to say what happened without the
diagnostic output from the DBMS to say which
process got deadlocked with which. For MS SQLServer,
doing inserts under an autoCommit(true) mode will
be just as fast if not faster, and will be much less
likely to hold locks that would block (or deadlock)
other connections.

Joe Weinstein at BEA

> Hello all,
>
[quoted text clipped - 26 lines]
>
> Silvio Bierman


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.