CodeIgniter Forums
Codiginiter Sqlsrv - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Codiginiter Sqlsrv (/showthread.php?tid=72937)



Codiginiter Sqlsrv - FEDY - 03-04-2019

Hi,

I'm getting that standard error that happens when there's something wrong with the sqlsrv driver specifications.

PHP Version 7.3.0

php.ini
Registered PHP Streams
php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar, sqlsrv


A Database Error Occurred

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

Filename: E:\[project_folde]\[project_name]\system\database\DB_driver.php
Line Number: 125

$active_group = 'default';

$active_record = TRUE;





$db['default'] = array(

    'dsn'    => '',

    'hostname' => 'DESKTOP-NDT1I0K\SQL2008E', // for example 'cmms-server\SQLEXPRESS' 

    'port' => '1433',

    'username' => 'sa',

    'password' => '[password]',

    'database' => '[database]',

    '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
);

In codeigniter  folder    \system\database\drivers\sqlsrv
file sqlsrv_driver.php line 89
I change
function db_pconnect()
{
return $this->db_connect(TRUE);
}


Any advice from other masters? Thank you.


RE: Codiginiter Sqlsrv - php_rocs - 03-04-2019

@FEDY,

See if you can do a direct connection to MSSQL without using CI. http://php.net/manual/en/function.sqlsrv-connect.php