Connect PHP to AS400 with ODBC or DB2

余生颓废 提交于 2019-12-08 07:44:46

问题


I'm trying to connect my WEB server to AS400. The web server has not DB2 library neither ODBC library.

I have installed XAMPP in my Windows computer, and one of my colleagues also did. He has Client Access on his Computer.

We both installed: - XAMPP - ibm_data_server_driver_package_win32_v10.5.exe

We tried to install PECL DB2 extension (LINK) but unsuccessfully (got error ".\php.exe appears to have a suffix .exe, but config variable php": seems that nobody has solved this problem on Windows...).

Then we saw that XAMPP has the ODBC Module already on it, so we tried to estabilish a connection with obdc_connect. Referring to THIS question we are now able to connect to AS400 using his computer with Client Access Drivers using:

$user = 'USER';
$password = 'PASS';
$hostname = '192.168.1.30';
$server="Driver={Client Access ODBC Driver (32-bit)};
         System=$hostname;
         Uid=$user;
         Pwd=$password;";

odbc_connect($server, $user, $password);

With my computer I tried to use the IBM data server driver already installed using:

$user = 'USER';
$password = 'PASS';
$hostname = '192.168.1.30';
$server="Driver={IBM DB2 ODBC DRIVER};
         System=$hostname;
         Uid=$user;
         Pwd=$password;";

odbc_connect($server, $user, $password);

and I get always this error:

Warning: odbc_connect(): in C:\xampp\htdocs\test.php on line 11

When I've tried with IBM DB2 ODBC DRIVER on my colleague's computer, I've also got the same error.

What is this error? No information is specified. We would like to use db2_connect instead of odbc_connect. What should we do to install this extension? I asked my ISP to install the db2 extension on the WEB server but I'm still waiting... maybe he also encountered some problems (the WEB server is a UNIX machine).

Any help is much apprecciated!

来源:https://stackoverflow.com/questions/24087322/connect-php-to-as400-with-odbc-or-db2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!