I have a MySql database in combination with a project in java. For some testing I have a script which drops all tables (if exists). This runs totaly fine a bunch of times but then suddenly it stops and my application is waiting for a response from the database. If I log in to my database and use:
SHOW PROCESSLIST
I find this entry "Waiting for table metadata lock" for the executed
DROP TABLE IF EXISTS
.
If I run it manually after creating the database all works fine. If I set a breakpoint right before the freezing statement and run my DROP command via MySQL Workbench I just get "connection lost while executing statement". The connection is not timeouting either, i waited for 30 minutes nothing happend, no exceptions failed tests or so.
The connection.getWarnings()
is always null.
I tried playing with auto commit mode, resetting connections, beginn and end requests,putting sleep timers (cause I thought its maybe an timing issue) but nothing works. Iam currently using a 8.0.29 Community MySQL server and Java 17.0.2 with prepared statements.
I would be really glad to get some suggestions for solving this.