1

I have completed all steps to connect mssql with xampp localhost. When I run code on localhost error were encountered as follows :

Error Number: 42S02/208

[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid object name 'ci_sessions'.

SELECT "data" FROM "ci_sessions" WHERE "id" = 'ca4680ccaa1d99c9a97e4a4a8d639f7f2b9e374e'

from comment

$active_group = 'default'; 
$query_builder = TRUE; 
$db['default'] = array( 
'dsn'   => '', 
'hostname' => 'MSSQLSERVER', 
'username' => '', 
'password' => '', 
'database' => 'travell', 
'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 
); 

How to resolve this problem?

  • 1
    show what you code – Pradeep Nov 02 '17 at 06:23
  • 2
    make sure the extension is loaded for the driver. Check phpinfo(). And in your `php.ini` make sure you have this extension `extension=php_mssql.dll` – ArtisticPhoenix Nov 02 '17 at 06:24
  • You need to have windows mssql drivers installed in your php folder – hungrykoala Nov 02 '17 at 06:27
  • $active_group = 'default'; $query_builder = TRUE; $db['default'] = array( 'dsn' => '', 'hostname' => 'MSQLSERVER', 'username' => '', 'password' => '', 'database' => 'travell', 'dbdriver' => 'pdo_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 ); This is my database.php file –  Nov 02 '17 at 06:32
  • I have added extension as well as mssql driver –  Nov 02 '17 at 06:34
  • check error log of xampp once .. did you check ? – Mittul At TechnoBrave Nov 02 '17 at 06:34
  • Yes I have checked it shows server certificate does not include an id which matches the server name –  Nov 02 '17 at 07:04
  • can you tell me how to load database library in autoload.php ? –  Nov 02 '17 at 08:39

2 Answers2

0

I think you miss db username, if options of phpmyadmin is default try username set to 'root'

'hostname' => 'localhost',
'username' => 'root',
'password' => '',
0

A Database Error Occurred

Error Number: 42S02/208

[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid object name 'ci_sessions'.

for above error of connectivity between MSSQL 2016, Codeigniter and Xampp (PHP 7.0) check the name given to the 'ci_sessions' table created in MSSQL database and give the same name in a config.php file where table_name was mentioned for the same table.