This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes Identifying Database Locked scenario Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Identifying Database Locked scenario " Watch "Identifying Database Locked scenario " New topic
Author

Identifying Database Locked scenario

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9916
    
158

I am not sure whether i am posting this in the correct forum. We are using SLSB(CMT) and Hibernate in our application. One of our SLSB interacts with the database for database operations. We are trying to find a way through which we can show the user a message whenever the Database is locked(may be for backup).
Here's our scenario:
- User through jsp does some operation, which results in the invocation of the SLSB
- The SLSB(with CMT) then does a database operation
- Consider a scenario in which the database is locked. In such a case the SLSB just waits(even after the transaction timeout). As a result the application just hangs.

The scenario occurs very rarely, but we would like to show a message to the user the database is currently locked. Is this possible? Any suggestions are welcome.

Thank you


[My Blog] [JavaRanch Journal]
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
What does your server log say? Surely there must be a exception thrown by the EJB container when the transaction times out. When this happens, I would expect the container to mark the transaction for rollback and throw RemoteException or EJBException to the client. Does the client receive any exceptions?


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9916
    
158

There's only a WARN message printed in the server log after the transaction times out. The transaction manager won't throw exceptions while the SLSB is waiting for the blocked database operation to complete (unless the SLSB does subsequent operations that involve the transaction manager)
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
What EJB server are you using? It is not behaving in the way I would expect. When an EJB's transaction times out, I would expect the server to end (rollback) the transaction.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9916
    
158

I am using JBoss-3.2.3. When the transaction times out the server marks the transaction for rollback and later on whenever any operation is done in context of this transaction, the exception is thrown
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Identifying Database Locked scenario
 
Similar Threads
Question about Transactions in EJB / MDB scenario
Its not necessary to use SLSB, or is it?
Transacton propagation across applications
partII: stateful session bean is necessary to serve as a booking cart?
Make hibernate use JTA transaction in WAS 5.1