Console App Issue With Mssql

When using my Console application with MySQL everything works as it should. However, when I use MSSQL then I keep getting this error:

When using createWebApplication it works with MSSQL, but not when using createConsoleApplication.

My db connection string looks like this:

Is this a bug or have I missed something here??

Hi my friend

Did you set the db connection in config/console.php or config/main.php ?

I tried to set it both in config/main.php and config/console.php. Currently I have my console.php file located in the same directory as index.php. This looks like this:

Then in config/main.php I have the db connection as shown in my previous post. I also created a copy of config/main.php called config/console.php and changed the line above to point to config/console.php but that did not work.

I read somewhere that the console application is by default looking at the settings in config/console.php, but I guess that since the config dirname is defined otherwise in my file, then it is using that path instead. Any ideas of what I have missed here?

Note that there are two console.php in this case. One config file and one where the actual console app starts.

Look at here, may be helps you

http://www.yiiframework.com/doc/guide/1.1/en/topics.console

And a similar post

http://www.yiiframework.com/forum/index.php/topic/3579-console-app-could-not-find-db-driver/

The problem was caused by the fact that the wrong php.ini was being loaded for the console application. In Windows, command prompt, write php --ini and it shows which php.ini is being loaded.

In addition I had to create a separate config/console.php which only contained the db connection string (and not all other config as copied from the main.php).

Thank you KonApaz!