将 PHP 连接到 IBM i (AS/400)

发布于 2024-07-03 23:58:33 字数 526 浏览 4 评论 0原文

我有一个即将进行的项目,其中我需要将我们的网站 (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 表示形式。

第二种选择似乎太过分了,还是其他人有更好的想法?

I've got an upcoming project wherein I will need to connect our website (PHP5/Apache 1.3/OpenBSD 4.1) to our back-end system running on an iSeries with OS400 V5R3 so that I can access some tables stored there. I've done some checking around but am running into some roadblocks.

From what I've seen the DB2 extensions and DB2 software from IBM only run under Linux. I've tried compiling the extensions with all the software from IBM and even tried their precompiled ibm_db2 extension with no luck. IBM only supports Linux so I turned on the Linux emulation in the kernel but that didn't seem to help anything.

If anyone has run across getting everything to run natively under OpenBSD that would be great, but what I think I may have to do is setting up a second server running CentOS with DB2 installed (most likely via ZendCore for IBM since it seems to do all this for me) and the driver so that I can set up a small transaction server that I can post against and get a JSON representation of the DB2 data that I need.

Does the second option seem overkill or does anyone else have any better ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

兰花执着 2024-07-10 23:59:33

为什么不使用 PHP 中的 PDO? 我必须在这里猜测,因为我找不到 OpenBSD 可用的所有端口的公共列表,但既然有一个用于 FreeBSD、NetBSD 等的端口,也许你也很幸运。

(我猜即使 OpenBSD 链接到 FreeBSD 的搬运工手册,Freshports 不适用于您的系统?

) PDO 不可用,因为我希望您使用端口,并且根据以下链接,可以使用 php5-ODBC:

因此,假设您通过端口管理系统,这里有您的指针。

希望有帮助!

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:

So assuming you manage your system through ports, there are your pointers.

Hope that helps!

〃温暖了心ぐ 2024-07-10 23:59:32

您也可以使用标准 ODBC 驱动程序直接连接。 IBM 版本通常为您提供更多功能,例如能够调用程序等。 如果您只需要 SQL 和存储过程,则 ODBC 应该可以使用。

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.

人生百味 2024-07-10 23:59:31

事实上,网络服务似乎是解决该问题的好方法。 避免使用完全独立的操作系统的一种方法是在 Java 的 AS400 工具之上用 Java 编写 Web 服务(顺便说一句,这非常好)。 这至少应该让您也可以在 OpenBSD 机器上运行服务层。

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.

独夜无伴 2024-07-10 23:59:30

Web 服务几乎肯定是最佳选择。 我相信您已经想到了这一点,但是由于您在两侧都使用 PHP,因此您可以通过使用 serialize() 来构建响应数据而不是构建适当的 XML 文档来简化一些事情。 从长远来看,它的灵活性较差,但它可能会让您更快地启动和运行。

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.

メ斷腸人バ 2024-07-10 23:59:28

看起来网络服务将是我的答案。 根据 PHP 文档,在生产环境中,我不想编译和维护我自己的 PHP 特殊安装,因为需要编译 ODBC 支持。

Looks like a web service is going to be the answer for me. On a production box I'd rather not have to go through compiling and maintaining my own special installation of PHP since ODBC support needs to be compiled in, according to the PHP documentation.

烟沫凡尘 2024-07-10 23:59:26

其次@John Downey,我已经通过unixODBC 连接到在AS/400 上使用PHP。

检查 phpinfo() 以查看 unixODBC 是否可用。 我不必在 SLES 10 上编译它。

To second @John Downey, I've gotten connectivity to work with PHP on an AS/400 with unixODBC.

Check your phpinfo() to see if unixODBC is available in it. I didn't have to compile it in on SLES 10.

为人所爱 2024-07-10 23:59:23

您为什么不研究 iSeries 的 PHP 连接器,而不是设置第二个盒子呢? 我的大型机人员说在我们的 iSeries 上设置非常容易。

我们用 PHP 编写了一个简单的服务器,它从 DB2 数据加载数据模型,序列化它们,然后将它们返回给调用者。 这种方法意味着只有另一个 PHP 应用程序可以使用该服务,但两端的速度要快得多,只需序列化对象并将其发送到管道中。

以下是 IBM 关于该主题的 PDF: http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf

Rather than setup a 2nd box, why don't you look into the PHP Connector for iSeries? My mainframe guys said it was very easy to setup on our iSeries here.

We wrote a simple server in PHP that loads data models from DB2 data, serializes them, and returns them to the caller. This approach means that only another PHP app can consume the service but it's just so much quicker on both ends to just serialize the object and send it down the pipe.

Here is a PDF from IBM on the subject: http://i-seriesusergroup.org/wp-content/uploads/2006/09/PHP%20for%20i5OS%20NESDND.pdf

晨与橙与城 2024-07-10 23:59:21

您是否考虑过使用 unixODBC 连接到服务器? 如果我没记错的话,它支持 IBM DB2 并在 OpenBSD 上编译。 有关 PHP 方面的更多信息,请查看 http://www.php.net/odbc

如果您无法做到这一点,那么您所能做的可能就是在 Linux 服务器上设置 Web 服务。

Have you looked at connecting to the server using unixODBC? If I remember correctly it has support for IBM DB2 and compiles on OpenBSD. Check out http://www.php.net/odbc for more information regarding the PHP side.

If you can't get that to work, the option to setup a web service on a Linux server may be all you can do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文