Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Transaction s- Database and JMS

 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I have some problem with EJB transactions. The code looks something like this...

ejbMethod(){
// database insertion using DAO
// publishing message using JMS
}

ejbMethod has transaction attribute *Required*. The problem is sometime JMS goes down i.e become really slow in responding. In this case, the particular table where we are inserting a record using DAO helds up and nobody can access that table. Is there anything like we can configure to release the database soon.

Please do respond.

Thanks and Regards,
Prashant
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you locking that table?
 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I am really stuck in this problem. Please help.

We are using Sybase database. As i mentioned in the shown example it is handing the database once response from queue delayed. The problem is with Sybase, even for insertion it is locking entire table.

Is there any way to not to lock table if transaction getting delayed in committing.

Thanks and Regards,
Prashant
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prashant,

Sybase allows setting either a pessimistic concurrency control (PCC) or an optimistic concurrency control (OCC). With PCC the data is locked during a transaction, even for reading. This model can introduce database deadlocks and usually reduces the app�s scalability. To make things worse, by default Sybase uses a page-lock schema which will not only lock the current row, but the entire page (which might have multiple rows). The db admin can change the default to a row lock, but this might degrade the overall db performances. At the other end is the table locking, which will overkill any multithreaded application. As a matter of fact, Sybes recommends the OCC for enterprise applications.
Can you confirm whether your database uses a PCC or OCC model? Another solution might be to partition the table, but in my opinion, you first need to understand the locking schema of your database.
Regards.
 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Valentin,

Thanks for your time. Since i am new to Sybase, please give me some links to undestand these PCC and OCC.

But i set the row level locking using following command.

ALTER TABLE <tablename>
LOCK DATAROWS command.

even then, the behaviour is not changed.

Please advice me.

Thanks and Regards,
Prashant
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!