Make the database connection timeout configurable
Description
The default database connection timeout is too low to use SQLite under reasonable load for testing without getting timeouts trying to read the database. This MR makes the timeout configurable, so that we can increase it to test SQLite without hitting sqlite-specific problems (other databases support more fine-grained locks so don't have the same problems).