• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

multiple inserts with multiple connections into same db table.

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I hope someone can help
I have two or more threads which are inserting into the same target database table, each having their own connection. The connection has autoCommit set to false and I am performing batch inserts (batch size 10) and am only commiting once all inserts have been performed per thread.

My problem is that I am getting a deadlock, which I can't understand because I am only inserting into the one table.

I am using sybase 12.5.1

some output from sp_lock is below


Any help would be appreciated,

thanks.
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are all thread invoking same method for insert.

if yes then you can add synchonized keyword to you method.
[ October 28, 2004: Message edited by: Shailesh Chandra ]
 
Scott William Sinclair
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for the response, there is no common method for inserting.

I managed to change the server locking schema to "datarows" instead of "allpages", so it is row based instead of table based and that seems to have fixed it. I'm just confused how a deadlock could ocurr in the first place, since normally a deadlock requires two resources to be in contention.
 
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic