问题
I want to use Doctrine2 ORM in my php application.
For DB2, Doctrine2 supports only pdo_ibm and ibm_db2 drivers.
I installed a local instance of DB2 (DB2 Express-C) and conneceted with pdo_ibm and ibm_db2 successfully and even using the local db2 instance my doctrine2 installation works fine and is functional,
but my real aim is to connect to a remote DB2 instance running on a i5/os. Remote connections to this (remote) DB2 works only using odbc and PDO_ODBC but fails with pdo_ibm and ibm_db2 resulting in the following error:
Could not connect SQLSTATE=42968, SQLDriverConnect: -1598 [IBM][CLI Driver] SQL1598N An attempt to connect to the database server failed because of a licensing problem. SQLSTATE=42968
回答1:
I don't use Doctrine, I use my own wrapper to swap on the database of my choice :
On Zend Server for Windows : I can use IBM DB2 for Windows with PDO and the extension ibm_db2, or I can use IBM DB2 for i5 with PDO and the "System i ODBC Driver" (provided with "System i Navigator" software).
On Zend Server for IBM i : I swap on the "ibm_db2" connector (and db2_connect).
You'll find the source code and the documentation of my project here : http://gregphplab.com/serendipity/index.php?/archives/2-MacaronDB.html You can reuse it, or just take the idea. Sorry but the documentation is only in french for the moment.
回答2:
Doctrine used to connect the function db2_connect
, but for i5 can connect using obdc_connect
. Do tests and see the results. db2_connect
is also available with PECL libraries
来源:https://stackoverflow.com/questions/14645605/connecting-to-remote-db2-on-i5-os-through-a-php-client-on-a-windows-machine-usin