0

I have a java application and when two instances of the application trying to start at once, i get the following error.This is mainly because both are accessing the same record.But isn't ReadLock is shared therefore multiple users can access it at one?

database.DatabaseLockException: Database locked. ErrorCode:'LOCKED' (Caused by com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock: wsrep aborted transaction) (vendorErrorCode: 1213) (problemStatement: SELECT ID,Licence_Id,Installation_Id,Generation_Date,Valid_From,Expiry_Date FROM Licences WHERE (Valid_From <= ? AND Expiry_Date >= ?) ORDER BY Generation_Date DESC)

Akina
  • 39,301
  • 5
  • 14
  • 25
sam1295
  • 3
  • 2
  • Is it `LOCK` locked or just deadlocked due to a timeout? It could be `WRITE` locked. If you can avoid locking, that's usually for the best. – tadman Dec 02 '20 at 11:32
  • Two concurrent SELECT statements cannot result in LOCK error. – Akina Dec 02 '20 at 11:38
  • Your error message suggests you have a `Deadlock:` So something else is causing that, NOT 2 select statements – RiggsFolly Dec 02 '20 at 12:52

0 Answers0