Added statement to select database based on port.