在Windows x64中从php连接到oracle数据库

发布于 2024-10-08 20:09:04 字数 735 浏览 1 评论 0原文

我正在尝试从 php 连接到 windows x64 中的 oracle 数据库

我使用: php5、apache2、oraclexe 10.2

我的文件“test.php”如下:

 <?php
  if ($c = oci_connect("SYSTEM", "root", "//localhost:1521/XE")) {
   echo "Successfully connected to Oracle.";
   oci_close($c);
  } else {
   $err = oci_error();
   echo "Oracle Connect Error " . $err['text'];
  }
 ?>

当我打开 localhost/test.php 时,出现以下错误:

Warning: oci_connect() [function.oci-connect]: ORA-06413: Connection not open

我不能理解这个错误的原因,因为我已经从Java连接到同一个数据库,并且我认为php.ini文件配置得很好,因为我设法从php连接到MySQL数据库。 还遵循了本教程: http://www.orafaq.com/wiki/PHP_FAQ

所以如果有人有解决方案和评论请发布

I am trying to connect from php to oracle database in windows x64

I use: php5, apache2, oraclexe 10.2

My file "test.php" is the following:

 <?php
  if ($c = oci_connect("SYSTEM", "root", "//localhost:1521/XE")) {
   echo "Successfully connected to Oracle.";
   oci_close($c);
  } else {
   $err = oci_error();
   echo "Oracle Connect Error " . $err['text'];
  }
 ?>

When I open localhost/test.php, getting a following error:

Warning: oci_connect() [function.oci-connect]: ORA-06413: Connection not open

I can not understand the cause of this error, because I have already connected to the same database from Java, and I think the php.ini file is well configured, because I managed to connect from php to MySQL database.
Also followed this tutorial: http://www.orafaq.com/wiki/PHP_FAQ

So if someone have a solutions and comments post it please

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

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

发布评论

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

评论(1

失退 2024-10-15 20:09:04

XE是你数据库的服务名吗?这是您必须更改的示例代码中使用的名称。

Is XE the service name of your database? That's the name used in the example code that you have to change.

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