2

I have installed Xampp and Codeigniter. Now I want to connect to a SQL database. I have installed the sqlsrv drivers on Xampp, so that works. I also fixed a bug in the sqlsrv_driver.php and changed this:

function db_pconnect()
{
    // $this->db_connect(TRUE); original
    return $this->db_connect(TRUE);
}

This is my config file:

$db['default']['hostname'] = 'ipAddress\instanceName';
$db['default']['username'] = 'xxx';
$db['default']['password'] = 'xxx';
$db['default']['database'] = 'xxx';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

I have the following error:

Unable to connect to your database server using the provided settings.

Filename: C:\xampp\htdocs\system\database\DB_driver.php

Line Number: 124

I had some errors with sqlsrv before, but I solved it by the answers on this question:

Connect sqlsrv in Xampp

Community
  • 1
  • 1
Marten
  • 1,376
  • 5
  • 28
  • 49

1 Answers1

1

there is an error with your hostname try to use

$db['development_local']['hostname'] = 'localhost';
Ijaz Ahmed Bhatti
  • 736
  • 1
  • 7
  • 26