Ruby: SQLite3::BusyException: database is locked:

For anyone else encountering this issue with SQLite locking in development when a Rails console is open, try this:

Just run the following:

ActiveRecord::Base.connection.execute("BEGIN TRANSACTION; END;")

For me anyway, it appears to clear any transaction that the console was holding onto and frees up the database.

This is especially a problem for me when running delayed_job, which seems to fail at closing the transaction quite often.

Leave a Comment