CodeIgniter Forums
Connecting to MSSQL 2008 returns a Blank Page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Connecting to MSSQL 2008 returns a Blank Page (/showthread.php?tid=25154)

Pages: 1 2


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 12-02-2009

[eluser]atomicx6637[/eluser]
Here are my settings:

$db['default']['hostname'] = "COGOSQL8D01";
$db['default']['username'] = "linuxwebuser";
$db['default']['password'] = "GftP1794xL";
$db['default']['database'] = "ServerDataDev";
$db['default']['dbdriver'] = "mssql";
$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";

I'm trying to connect to a SQL Server 2008 database and when I do I just get a blank page. Is there a way to figure out if there is a database error being thrown that is not being displayed on the page?

Thanks
Troy


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 12-06-2009

[eluser]_krc_[/eluser]
Hi

I would also appreciate any feedback on this, because I have exactly the same problem with SQLS2008..


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 12-21-2009

[eluser]Unknown[/eluser]
PHP version 5.3.0 + It OK.
But I have problem with database type nvarchar

A Database Error Occurred

Error Number:

Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 12-21-2009

[eluser]Aken[/eluser]
MSSQL is deprecated in PHP 5.3.x. I'm not sure how CodeIgniter has handled that, if they use the new SQLSVR wrapper from Microsoft or not. But MSSQL isn't supported anymore.


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 01-18-2010

[eluser]Unknown[/eluser]
Any solution to this. I can connect directly to PHP using code like

/* Connect to the local server using Windows Authentication */
$serverName = "127.0.0.1";
$connectionInfo = array( "UID"=>"username",
"PWD"=>"password",
"Database"=>"databasename");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn === false )
{
echo "Could not connect.\n";
die( print_r( sqlsrv_errors(), true));
}


but when I tried to connect inside of CI I get a blank screen as well.


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 07-12-2010

[eluser]prabeen.giri[/eluser]
Use $config['uri_protocol'] = "PATH_INFO"; on your config file . I think this will help.


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 07-20-2011

[eluser]winner[/eluser]
[quote author="prabeen.giri" date="1278945083"]Use $config['uri_protocol'] = "PATH_INFO"; on your config file . I think this will help.[/quote]

Tried that and I am still getting

Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.

Any other ideas?


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 07-21-2011

[eluser]prabeen.giri[/eluser]
I also had similiar problem with unicode characters and ODBC as a database driver. So I was bound to use SQLSRV as a database driver. For that u need to install the SQLSRV from microsoft site in the server and SQLSRV database library for CodeIgniter. And change the database driver as 'sqlsrv' in the database config file.

you will also require php_sqlsrv php extension installed and enabled.

You can download the SQlSRV database library for Codeigniter from her "http://code.google.com/p/sqlsrvdrivercodeigniter/" and install according to the instructions provided.

Problem is earlier version of ODBC does not have unicode support.

It works and working properly in one of my project.
I hope this helps.


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 07-21-2011

[eluser]winner[/eluser]
Hey Summer Student thanks again for ur fast response.

I went to here to download the http://sqlsrvphp.codeplex.com/releases/view/31762 the latest 2.0 driver.

Then changed database.php and DB_driver_php to use 'sqssrv'. Then I am getting


Fatal error: require_once() [function.require]: Failed opening required 'D:/webserve/test/system/database/drivers/sqlsrv/sqlsrv_driver.php' (include_path='.;C:\php5\pear') in D:\webserve\intraweb\winston\system\database\DB.php on line 138

Then I checked the forums to find I do not have the correct access.
http://ellislab.com/forums/viewthread/62505/

Hmmm.. don't think my manager would approve of the access. This is an underground project. I think I will try the manual PHP why. Unless there is something else I might try....?


Connecting to MSSQL 2008 returns a Blank Page - El Forum - 07-21-2011

[eluser]prabeen.giri[/eluser]
Dont panic, there is a way , perhaps you might not have configure properly.
This is what I say , first install SQLsrv driver on the server computer.

Then you need a CI sqlsrv library which communicates with the SQLsrv driver to make connection and database query with MSSQL server.

Download SQLsrv database library from the above link I mentioned and add the new sqlsrv library to this location under you CI folder "system/database/driver" like we can see other "mysql", "mysqli" CI database library.

Other thing I want to tell u there is always a solution but sometime it can be painful finding the correct solution.
Furthermore I would recommend using framework over custom PHP , particularly CodeIgniter ..Smile