• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with CI, MS SQL, Server 2008 R2

Pardon for the potential duplicate post; I couldn't find the exact issue I am having.

I'm using CI 2.1.2, IIS 7.5 on Windows 2008 Standard R2 with MS SQL 2008. I'm using the sqlsrv driver in my database.php file and have the php_sqlsrv.dll enabled in IIS.

I've got the database library autoloaded and everything loads as expected; no blank pages as others have had, etc. However, when I try to perform a simple query with the database, I get an IIS Internal Server Error 500.

Due to client requirements, I have to use the above setup (Windows, MSSQL, etc) and I'm not familiar with MS SQL, but I believe it could be something funny with my models. I noticed MS SQL adds a "dbo." in front of each table. For example, one of my table names is "tblUser" Should the table be named "dbo.tblUser" and does my model name and class inside the model need to reflect this? Any help is greatly appreciated.

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '****';
$db['default']['password'] = '****';
$db['default']['database'] = '****';
$db['default']['dbdriver'] = 'sqlsrv';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$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 setup a MySQL server on the Windows Server box and I'm getting similar symptoms. CI is connecting with the MySQL server, but any DB interaction causes a 500 error.


if ($this->dbutil->database_exists('database_name'))
   // some code...

Produces this in the IIS log file:

[05-Sep-2012 16:54:35 UTC] PHP Fatal error:  Call to a member function database_exists() on a non-object in C:\inetpub\wwwroot\application\views\dashboard_view.php on line 83

I use MSSQL as well, but with apache ATM. There shouldn't be a need to prefix the table names with "dbo" -- this is optional. It sounds like there's an issue with instantiating the dbutil, and probably other objects. Assuming you're using an IDE, can you set a breakpoint at the line above and see what the $this super object contains?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.