We can connect Yii and SQL Server following instructions in http://www.youtube.com/watch?v=2iWa303gi1w. 100% correct, tested by some programmers in our team :D.
But sadly, it is not a perfect world for all of us, including me. I kept up with the video and repeated it thousand times just to end up with SQLSTATE[HY000][-1] error. It didn’t happen to fellow programmers mentioned in paragraph above, and I thought it was my beloved OS fault (Windows7 32 bit).
Mr Google couldn’t give proper answer, so I began asking coding geniuses I know. One genius told me to check Sql Server connection using telnet. Ok… I opened command prompt and write
telnet 127.0.0.1 1433
In seconds system answer me, “Connecting To 127.0.0.1…Could not open connection to the host, on port 1433: Connect failed”. Yes, 1433 is SQL Server default port. And by the way, you could activate Microsoft’s telnet client through control panel.
I peeked into the other programmer’s Sql Server Configuration ….. damn his TCP/IP connection is enabled by default (and mine is not, how life is unfair). Well, maybe that genius was right, so I tried to enable SQL Server TCP/IP connection using SQL Server Configuration Manager. Below is the picture or so, taken from techtarget.com.
I clasped my hands and refresh Yii page. Voila, nightmare was over, Yii and SQL Server are now living happily ever after.
Leave a Reply