简体   繁体   中英

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.

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 . Can someone tell me if the port number and sid are required or not?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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