Connect Yii and SQL Server

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.

Activate Telnet

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.

configure tcp ip

I clasped my hands and refresh Yii page. Voila, nightmare was over, Yii and SQL Server are now living happily ever after.


Posted

in

by

Comments

One response to “Connect Yii and SQL Server”

  1. […] ribet Yii gagal connect ke SQL Server dan PHP di server gagal mengeksekusi file .exe. Untungnya masalah Yii dan SQL server sudah pernah dialami sebelumnya jadi bisa diselesaikan dengan segera. PHP yang gagal mengeksekusi […]

Leave a Reply

Your email address will not be published. Required fields are marked *