Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
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.
 
Bartender
Posts: 2658
19
Netbeans IDE C++ Linux
  • 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: 2658
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't you have to commit your transaction to end the locking situation?
 
Whatever you say buddy! And I believe this tiny ad too:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic