Fix query included in database name