wood burning stoves 2.0*
The moose likes JDBC and the fly likes java.sql.SQLException: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: "Table Watch "java.sql.SQLException: "Table New topic
Author

java.sql.SQLException: "Table 'X' was not locked with LOCK TABLES"

somenath chatterjee
Greenhorn

Joined: Mar 20, 2008
Posts: 16
Hi,
I am using mysql version- 3.23.49a. Sometime i am getting a exception that is -
java.sql.SQLException: General error message from server: "Table 'X' was not locked with LOCK TABLES".
please send me solution if anybody had faced this kind of problem.
Thank you.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

You have locked another table, and per MySQL docs:
A session that requires locks must acquire all the locks that it needs in a single LOCK TABLES statement.

See the hyperlink above for the cause and solution.

OCUP UML fundamental and ITIL foundation
youtube channel
somenath chatterjee
Greenhorn

Joined: Mar 20, 2008
Posts: 16
thank you for reply, I have seen the MYSQl doc.Well, I am explain you the what is the problem actually I am getting.
I am using LOCK for a table(eg: Table A) in a method, And after complete process of that method doing UNLOCk that table(Table A)in finally block. But I got the LOCK Exception from different table(eg: Table B) of a different method on a select sql query. Which is doesn't have any relation with Table A. Please suggest me how to fixed this issue.
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Don't you have to commit your transaction to end the locking situation?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.sql.SQLException: "Table 'X' was not locked with LOCK TABLES"
 
Similar Threads
CPU cicles in lock method
Row locks and transaction levels
How to test Network mode?
JPA Lock Table
Code hangs on a preparesStatement insert