Codeigniter: How to setup connection to a SQL server (2008)

前端 未结 4 1162
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 05:48

I\'ve spent many days on this task, and I can\'t see the end until now. In the past day I managed to install sqlsrv driver on my PHP environment successfully but now when I

相关标签:
4条回答
  • 2020-12-07 06:08

    I've had the same trouble you've had about a year ago. Have a look at the replies here, there are some great suggestions from people in there: CodeIgniter MSSQL connection

    Also, a thread was posted a few days ago here: CI connect to SQL SERVER - check out my answer over there as well, since it's solved the problem for that particular developer.

    0 讨论(0)
  • 2020-12-07 06:10

    I had the same problem solved by setting

    $ db ['default'] ['pconnect'] = FALSE;

    0 讨论(0)
  • 2020-12-07 06:13

    Make 1. $db['default']['pconnect'] = FALSE;. Then go to system/database/drivers/sqlsrv/sqlsrv_driver.php

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

    and

    function affected_rows()
    {
        //return @sqlrv_rows_affected($this->conn_id);
        return @sqlsrv_num_rows($this->result_id);
    }
    
    0 讨论(0)
  • 2020-12-07 06:28

    I would've wrote a comment, but I haven't the required reputation yet. Anyways...

    I noticed your hostname 'ENJ01\SQLEXPRESS', have you tried using 'localhost' instead?

    Also, try setting the port to 1433, with $db['dbname']['port'] = 1433;

    0 讨论(0)
提交回复
热议问题