CodeIgniter Forums
Connecting to SQL Server database - 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: Connecting to SQL Server database (/showthread.php?tid=77774)



Connecting to SQL Server database - philfry - 10-16-2020

I have some database connections in database.php that work fine. I want to create a connection on the fly without going through database.php because I don't know what the database will be until I connect.

Previously I could use $dbconn=mssql://username@instance/dbname

Then use $seldb=$this->load->database($dbconn,true);

Can I assume that by doing mssql it is trying to use the old mssql connection? It fails with an error:

Type: Error

Message: Call to undefined function mssql_connect()

I don't see anything in my code explicitly referencing mssql_connect. Any help would be appreciated. 


RE: Connecting to SQL Server database - includebeer - 10-18-2020

The old mssql database driver still use mssql_connect() but it looks like this function no longer exist since a very long time: https://stackoverflow.com/a/42536672

If  you still want to use SQL Server with CI3, somebody will need to update the mssql driver. And if you want to use it with CI4, somebody will need to write a new driver because it's currently not supported: https://codeigniter4.github.io/userguide/intro/requirements.html?highlight=mssql