我有一个即将进行的项目,其中我需要将我们的网站 ( PHP5/Apache 1.3/OpenBSD 4.1) 连接到我们的后端系统,该系统在具有 OS400 V5R3 的 iSeries 上运行,以便我可以访问存储在那里的一些表。我已经做了一些检查,但遇到了一些障碍。 据我所知,IBM 的 DB2 扩展和 DB2 软件只能在 Linux 下运行。我试过使用 IBM 的所有软件编译扩展,甚至尝试过他们预编译的 ibm_db2 扩展,但没有成功。IBM 只支持 Linux,所以我在内核中打开了 Linux 仿真,但这似乎没有任何帮助。 如果有人遇到过让一切都在 OpenBSD 下本机运行,那会很棒,但我认为我可能需要做的是设置第二台运行 CentOS 并安装了 DB2 的服务器(最有可能通过 ZendCore for IBM,因为它似乎可以完成所有工作这对我来说)和驱动程序,以便我可以设置一个小型事务服务器,我可以针对该服务器发布并获取我需要的 DB2 数据的 JSON 表示。 第二种选择是否显得矫枉过正,或者其他人有更好的想法吗?


您是否看过使用unixODBC连接到服务器?如果我没记错的话,它支持 IBM DB2 并在 OpenBSD 上编译。查看http://www.php.net/odbc以获取有关 PHP 端的更多信息。 如果您不能让它工作,那么您可以选择在 Linux 服务器上设置 Web 服务。
为什么不研究 PHP Connector for iSeries,而不是设置第二个框?我的大型机人员说在这里我们的 iSeries 上设置非常容易。 我们用 PHP 编写了一个简单的服务器,它从 DB2 数据加载数据模型,序列化它们,并将它们返回给调用者。这种方法意味着只有另一个 PHP 应用程序可以使用该服务,但它只是在两端更快地序列化对象并将其发送到管道中。 这是 IBM 关于该主题的 PDF:http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf
对于第二个@John Downey,我已经连接到使用 UnixODBC 的 AS/400 上的 PHP。 检查您的 phpinfo() 以查看 unixODBC 是否可用。我不必在 SLES 10 上编译它。
看起来网络服务将成为我的答案。根据 PHP 文档,在生产环境中,我宁愿不必编译和维护我自己的特殊 PHP 安装,因为需要编译 ODBC 支持。
A web service is almost certainly the way to go. I'm sure you've already thought of this, but since you're doing PHP on both sides, you can shortcut things a little bit by using serialize() to build your response data instead of building a proper XML document. It's less flexible over the long run, but it will probably get you up and running more quickly.
Indeed, a webservice seems like a great way to solve the problem. One way to avoid having a completely separate OS for it would be to write the webservice in Java on top of the AS400 tools for Java (which are quite nice, btw). That should at least let you run your service layer on the OpenBSD box as well.
You can connect directly using a standard ODBC driver as well. The IBM version usually gives you more features like being able to call programs and things like that. If you only need SQL and stored procedures, ODBC should work.
Why not use PDO from PHP? I have to guess here since I could not find a public list of all ports available for OpenBSD, but since there is a port for FreeBSD, NetBSD etc. maybe you get lucky as well. (I guess that even though OpenBSD links to FreeBSD's porter's handbook, Freshports is not applicable for your system?) If PDO is not available and since I am hoping you use ports and according to the following link there is php5-ODBC available: http://www.openbsd.org/pkg-stable40.html So assuming you manage your system through ports, there are your pointers. Hope that helps!