aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 2477
    
    7

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: 2477
    
    7

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
How to test Network mode?
CPU cicles in lock method
Code hangs on a preparesStatement insert
JPA Lock Table
Row locks and transaction levels