Block and query the databases in the main thread