连接到与 PHP 不同的服务器上的 Oracle 数据库

发布于 2024-10-10 10:25:12 字数 237 浏览 0 评论 0原文

您好,我有一个数据库引擎位于远程服务器上,而我的网络服务器位于本地。我经常使用客户端-服务器架构,其中服务器同时具有网络服务器和数据库引擎。现在我需要连接到位于不同服务器上的 Oracle 数据库。

有人可以给我任何建议吗?我相信 ODBC_CONNECT 可能不起作用。我使用 OCI8 驱动程序吗?我将如何连接到我的数据库服务器。

此外,我还会有大量的数据库来回调用,因此使用持久连接是否很好,还是仍然使用单独的数据库调用?

Hello I have a database engine sitting on a remote server, while my webserver is present locally. I have worked pretty much with client-server architecture, where the server has both the webserver and the database engine. Now I need to connect to an Oracle database which is situated on a different server.

Can anybody give me any suggestions?? I believe ODBC_CONNECT might not work. Do I use OCI8 drivers?? How would I connect to my database server.

Also I would have a very high number of database calls going back and forth, so is it good to go with persistent connection or do I still use individual database calls?

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

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

发布评论

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

评论(2

§普罗旺斯的薰衣草 2024-10-17 10:25:12

如果您使用 ODBC,则需要使用 PHP 的 ODBC 驱动程序 而不是 OCI8 驱动程序。否则,您需要在 Web 服务器上安装 Oracle 客户端(即使它只是 Oracle 的即时客户端),然后您就可以使用 OCI8。

编辑

就我个人而言,我不推荐持久连接。虽然连接到数据库(尤其是远程数据库)时速度会变慢,但如果命中计数很高(超过可用的持久连接数),或者出现任何类型的网络中断,持久连接可能会导致更多问题。在数据库上留下孤立的连接,也可能留下孤立的pconnectiosn。

If you're using ODBC, then you need to use the PHP's ODBC driver rather than the OCI8 driver. Otherwise, you need the Oracle client installed on your webserver (even if it's just Oracle's Instant Client) and then you can use OCI8.

EDIT

Personally I wouldn't recommend persistent connections. While there is a slowdown when connecting to a database (especially a remote database), persistent connections can cause more issues if you have a high hit count (exceeding the number of persistent connections available), or if there's a network hiccup of any kind that leaves orphaned connections on the database, and potentially orphaned pconnectiosn as well.

锦上情书 2024-10-17 10:25:12

Oracle 客户端适用于每个平台。总之,它是与 Oracle 通信所需文件的集合以及 Oracle 的命令行实用程序。只需访问 oracle.com 并下载

Oracle client comes for each platform. In summary it is collection of needed files to talk to oracle and a command line utility for oracle. Just go to oracle.com and downloads

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