简体   繁体   English

使用PHP代码连接到Oracle Database 11g

[英]Connecting to Oracle Database 11g using PHP code

I am trying to develop a web application with php that will connect to an 11g oracle database. 我正在尝试使用php开发一个Web应用程序,该应用程序将连接到11g oracle数据库。

Here is my code: 这是我的代码:

//database parameter
$db_name = "my_base";
$user = "username";
$password = "password";
$sid = "sid_number";
$port = "1521";

//function of connection
$conn = oci_connect ($user, $password, "//localhost/".$db_name);

Is the connection line correct? 连接线是否正确? Also I'm not introducing the port number and sid . 另外,我没有介绍端口号和sid Can someone tell me if the port number and sid are required or not? 有人可以告诉我是否需要端口号和sid吗?

您的连接字符串正确,不需要端口号和服务号,但是如果无法连接,并且您更改了默认设置,则可以始终在连接字符串中添加端口号和服务,例如[//]host_name[:port][/service_name][:server_type][/instance_name]从此处了解更多信息http://php.net/manual/en/function.oci-connect.php#refsect1-function.oci-connect-parameters

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM