SQLite vacuum and SqlDB components lazarus / 16-Databases ---------------------------------------------------------------------- kpeters58 · 2013-06-07 15:53 Hi, How does one vacuum a SQLite database from a SqlDB component? I either get 'cannot vacuum from with transaction' or  'transaction not set' - seems like a catch 22 to me. Please suggest only something known to work - I just went through quite a number of (obviously untested and thus not working) suggestions.... Thanks for all input, Kai ---------------------------------------------------------------------- taazz · 2013-06-07 16:47 You can't sqlDB does not work outside of a transaction. You have to use a SQLite specific component and see if that can do it or use the API directly. ---------------------------------------------------------------------- rasberryrabbit · 2013-06-07 22:52 Sqlitepass may help you. http://source.online.free.fr/ ---------------------------------------------------------------------- Pascaluvr · 2013-06-08 02:49 procedure TBSel.butVacuumClick(Sender: TObject); begin   Conn.ExecuteDirect('End Transaction');  // End the transaction started by SQLdb   Conn.ExecuteDirect('Vacuum');   Conn.ExecuteDirect('Begin Transaction'); //Start a transaction for SQLdb to use end; Please Note:  The above runs without error - i cannot be sure that the 'vacuum' has done whats required. ---------------------------------------------------------------------- kpeters58 · 2013-06-18 14:03 I just built a very fragmented database and tested your code - it works like a charm! Thanks, Kai