Fix database connection timeout. Load active record middlewares.