Use Yii with DB2 on Windows

Hi!

Small info how you can connect to a IBM DB2 Database on Windows with Yii.

  1. Check if you have enabled PDO_ODBC (with phpinfo or in your php.ini)

  2. Make a System-DSN Settings for your DB2 Database (if not already existing)

  3. Add following code to your config file.




'db2' => array(

	'class'=>'CDbConnection',

	'connectionString' => 'odbc:DSN=DB2db;UID=username;PWD=password',

	'emulatePrepare' => false,

	'charset' => 'utf8',

),



HINT: emulatePrepare does not work, so deactivate it or delete the line!!

On Linux it should be relative similar to get a connection.

You just have to install it correctly ;) (PDO ODBC install)

I have schema reading problem when I want to generate the model with gii.

"CDbConnection does not support reading schema for odbc database"…

Any clue?

Many thanks

My extension for IBM DB2: YiiDB2