diff --git a/system/Database/SQLSRV/Connection.php b/system/Database/SQLSRV/Connection.php
index <HASH>..<HASH> 100755
--- a/system/Database/SQLSRV/Connection.php
+++ b/system/Database/SQLSRV/Connection.php
@@ -129,12 +129,11 @@ class Connection extends BaseConnection
 			unset($connection['UID'], $connection['PWD']);
 		}
 
+		sqlsrv_configure('WarningsReturnAsErrors', 0);
 		$this->connID = sqlsrv_connect($this->hostname, $connection);
 
 		if ($this->connID !== false)
 		{
-			sqlsrv_configure('WarningsReturnAsErrors', 0);
-
 			// Determine how identifiers are escaped
 			$query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
 			$query = $query->getResultObject();
Set WarningsReturnAsErrors = 0 before connection (#<I>)

* Set WarningsReturnAsErrors = 0 before connection



If there is a warning establishing the connection, it will treat it as an error and Codeigniter will throw an exception. It should be configured prior the first sql command.



* Removed extra whitespace