…Hi …Im new in using Yii Framework and recently I found it very interesting…
…HOwever, I was wondering, is it possible to connect a MSSQL Database with Yii.??
…If so…then could anyone please tell me how…
…Hi …Im new in using Yii Framework and recently I found it very interesting…
…HOwever, I was wondering, is it possible to connect a MSSQL Database with Yii.??
…If so…then could anyone please tell me how…
Welcome to the forum.
From a windows box you should be able to use a config similar to this one. Ensure that you have an appropriate driver installed e.g. php_pdo_sqlsrv_53_nts_vc9.dll.
'db'=>array(
'connectionString' => "sqlsrv:server=localhost\SQLEXPRESS;database=some-database",
'username' => 'some-username',
'password' => 'some-password',
),
(Also, there is a number of existing MS SQL discussions in the forum)
/Tommy
…ok…I already got all the .dll files you said…
…But I still don’t know where to place all these files…
…Im using "xampp"…
I used this driver trying out an IIS-based installation. Don’t know exactly what XAMPP will need (my current XAMPP bundled PHP seems to be too old for this driver).
Generally speaking, drivers goes into the php/ext/ subfolder. You will have to add a line to php.ini similar to
extension=php_pdo_sqlsrv_53_nts_vc9.dll
(It’s also possible to store the driver elsewhere and specify a path)
I guess we have other forum users able to tell you exactly what to do. I also suggest you search the forum for additional MS SQL/XAMPP hints.
/Tommy
It`s very easy and most stuff was already said, but afaik xampp php was compiled with vc6 up to version 1.7.4 here, so if you are below that version you have to use the ts_vc6dll.
So you´d need to use the php_pdo_sqlsrv_53_ts_vc6.dll downloadable at microsoft/download/en/details.aspx?id=20098 . If you have chosen the correct path during installation (X:\…\…\php\ext) you just have to add
;extension=php_sqlsrv_53_ts_vc6.dll ; Procedual Interface
extension=php_pdo_sqlsrv_53_ts_vc6.dll
into your php.ini`s extension section. (Restart PHP after that)
btw. I never worked with sqlsrv+yii, so I never looked up, if yii even supports sqlsrv, just had some other projects using mssql but not yii
…Well…I’ve tried reading some forums regarding to this…I also followed all the suggested solutions…I already have the drivers I need (I supposed)…and put it where it should be placed…
…However, I still got this error…
…what should I do now…??..2538
It seems like the db component part of your configuration file (protected/config/main.php) doesn’t take effect. If this doesn’t help you out, show us the file content.
/Tommy
You define the db config twice. Comment out the first one (sqlite).
Note the driver name in this post.
HTH (I didn’t try it myself under XAMPP). At least you should see a different error message.
/Tommy
…oh hi again…I’ve got this error while trying to create a model in 'giic’2553
…I just want to know what is this error?
Looks like you modified the framework source and forgot about it. You don’t need to (and should not) modify the framework.
Reinstall the framework files, run yiic webapp, then enter the correct connection string and db credentials in the config file. Enter a password for Gii (there’s nothing such as giic). Access the database creating a model. That’s it.
Of course you have debug enabled in the start script index.php.
If no luck, check with phpinfo that you have the sqlsrv driver loaded. (You may encounter an error message suggesting you’ll have to download and install an additional driver. At least I had to do that for my XP box.)
/Tommy