Oracle Database 10g Express Edition
Add tnsnames.ora
//-- C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN\tnsnames.ora --
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
Download and Install XAMPP
Enable Oracle in php.ini
extension=php_oci8.dll
extension=php_pdo_oci8.dll
http://localhost/xampp/adodb.php
Database server: oci8
Host of the DB server: localhost
Username: scott
Password: tiger
Current database on this database server: XE
Selected table of database: emp
click submit
The example:
DBServer: oci8
//-- connectOracle.php --
<?php
header('Content-type: text/html; charset=UTF-8');
header('Vary: Accept-Language');
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php
include "/adodb/adodb.inc.php";
$db = NewADOConnection("oci8");
$db->charSet = "utf8";
$db->Connect("XE", "scott", "tiger");
$rs = $db->Execute("select * from emp");
while ($arr = $rs->FetchRow()) {
print_r($arr);
echo "<hr>";
}
?>
</body>
</html>
沒有留言:
張貼留言