- $this->connLogger->warning( "Failed to connect to database $i at '$serverName'." );
- $this->errorConnection = $conn;
- $conn = false;
+ if ( !isset( $this->mServers[$i] ) || !is_array( $this->mServers[$i] ) ) {
+ throw new InvalidArgumentException( "No server with index '$i'." );
+ }
+ // Open a new connection
+ $server = $this->mServers[$i];
+ $server['serverIndex'] = $i;
+ $server['autoCommitOnly'] = $autoCommit;
+ $conn = $this->reallyOpenConnection( $server, false );
+ $host = $this->getServerName( $i );
+ if ( $conn->isOpen() ) {
+ $this->connLogger->debug( "Connected to database $i at '$host'." );
+ $this->mConns[$connKey][$i][0] = $conn;
+ } else {
+ $this->connLogger->warning( "Failed to connect to database $i at '$host'." );
+ $this->errorConnection = $conn;
+ $conn = false;
+ }