function check_db(db_file)
    if exist(db_file, 'file') == 0
        fprintf('Database file not found: Creating new one !\n');
        create_db(db_file);
    end
    conn=sqlite(db_file);
    try
        sql = 'SELECT * FROM images';
        curs = fetch(conn, sql, MaxRows=1);
        sql = 'SELECT * FROM rtr';
        curs = fetch(conn, sql, MaxRows=1);
        close(conn);
    catch
        warning('Database file is corrupted: Creating new one !');
    end
end