使用Xampp在php中连接Oracle数据库

如何使用xampp在php中连接Oracle数据库?


这样对吗?


$servername = "localhost";

$username= "username";

$password= "password";

$dbname = "db";


$conn= new mysqli($servername,$username,$password,$dbname);


// check connection

if($conn->connect_error){

   die("connection Failed:".$conn->connection_error);

}


一只甜甜圈
浏览 286回答 3
3回答

ABOUTYOU

$username="OE";$password="OE";$db="(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = XE)))";$connection = oci_connect($username, $password, $db);if (!$connection) {$e = oci_error();echo htmlentities($e["message"]);}

繁华开满天机

试试这个查看$ HOME / public_html / connect.php中的代码<?php// Create connection to Oracle$conn = oci_connect("phphol", "welcome", "//localhost/orcl");if (!$conn) {&nbsp; &nbsp;$m = oci_error();&nbsp; &nbsp;echo $m['message'], "\n";&nbsp; &nbsp;exit;}else {&nbsp; &nbsp;print "Connected to Oracle!";}// Close the Oracle connectionoci_close($conn);?>oci_connect()函数包含用户名,密码和连接字符串。在这种情况下,将使用Oracle的Easy Connect连接字符串语法。它由主机名和数据库服务名组成。oci_close()函数关闭连接。脚本结束时,任何未明确关闭的标准连接都将自动释放。

哔哔one

试试这个只是用这个功能发出查询请求mysqli_query($ connectionhandler,$ sqlquery);
打开App,查看更多内容
随时随地看视频慕课网APP