I have spent many days on this task, and I can not see the end until now.
settings in application/config/database.php
I have two servers, in first server i have installed PHP and Xammp and in 2nd server have SQL Server and authentication mode is Windows
$db['attn'] = array(
'dsn' => '10.166.32.21',
'hostname' => 'APP01/MSSQLSERVER2012',
'username' => 'DOMAIN/Administrator',
'password' => '',
'database' => 'xample',
'dbdriver' => 'sqlsrv',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE);
I have latest version of PHP and CodeIgniter
anything wrong is my configuration
public function connect_sql()
{
try
{
$live = $this->load->database('attn',TRUE);
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
}