Yii 1.1: yiidb2

Support the IBM DB2 database in Yii Framework


Support the DB2 database in Yii Framework

Donation: Pagseguro, PayPal


  • PHP module pdo_ibm; (for ibm_pdo, see GitHub)
  • DB2 Client installed


  • For pdo_ibm or pdo_odbc, use yiidb2-*.zip
  • For ibm_db2, use yiidb2-ibm_db2-*.zip


  • Install yiidb2 extension
  • Extract the release file under protected/extensions
  • In your protected/config/main.php, add the following:
  'components' => array(
    'db' => array(
      'connectionString' => 'ibm:DRIVER={IBM DB2 ODBC DRIVER};DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;',
      'username' => 'username',
      'password' => 'password',
      'class' => 'ext.yiidb2.CIbmDB2Connection',


Total 3 comments

#14243 report it
sit at 2013/07/29 11:22pm

It 's very nice.

Thanks so much.

#14242 report it
Edgard Messias at 2013/07/29 09:50pm
Added support for DB2 iSeries

Added support for DB2 iSeries. Follow in GitHub.

#14216 report it
sit at 2013/07/27 04:42am
I can't connect to db2 (iseries).

I have tried to connect to iseries but It dose not work. perhaps I have something setting wrong.

when I have tried to use this code is below

'db' => array( 'connectionString' => 'ibm:DRIVER={IBM DB2 ODBC DRIVER};DATABASE=database;HOSTNAME=hostname;PORT=port;PROTOCOL=TCPIP;', 'username' => 'username', 'password' => 'password', 'class' => 'ext.yiidb2.CIbmDB2Connection', ),

I have get error message is below

CDbCommand failed to prepare the SQL statement: SQLSTATE[42S02]: Base table or view not found: 0 [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL7967 - PREPARE of statement COLUMNS completed. (SQLPrepare[0] at ext\pdo_odbc\odbc_driver.c:206)

but when I have tried to use this code is below

'db' => array( 'connectionString' => 'odbc:Driver={Client Access ODBC Driver (32-bit)};System=PUTSERVERNAMEHERE;DATABASE=PUTSCHEMAHERE;UID=PUTUSERHERE;PWD=PUTPASSWORDHERE;', 'class' => 'ext.yiidb2.CIbmDB2Connection', ),

the error message is below

CDbConnection failed to open the DB connection: SQLSTATE=42968, SQLDriverConnect: -1598 [IBM][CLI Driver] SQL1598N An attempt to connect to the database server failed because of a licensing problem. SQLSTATE=42968

how can I do it.

Thanks in advance for your advice.

Leave a comment

Please to leave your comment.

Create extension