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

5
  • Answer to this question - stackoverflow.com/questions/22831500/connect-sqlsrv-in-xampp/… Commented Apr 3, 2014 at 12:58
  • I wouldn't even use codeigniter. As we speak right now I'm having to add a feature to a codeigniter project and I Commented Apr 4, 2014 at 18:29
  • Why shouldn't I use CodeIgniter? It is an existing project, so I don't have a choice. Commented Apr 5, 2014 at 7:35
  • You can use Codeingiter for SQL connect but your webserver do need an SQL driver.. Commented Jul 10, 2014 at 9:32
  • CodeIgniter is outdated. You'd better use Laravel. ;) Commented Jul 10, 2014 at 10:02

1 Answer 1

1

there is an error with your hostname try to use

$db['development_local']['hostname'] = 'localhost';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.