• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
somenath chatterjee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
somenath chatterjee
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't you have to commit your transaction to end the locking situation?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic