我遇到Oracle连接问题,我正面临错误信息:oci connect():ORA-12154 我使用的是Xampp端口:80 oracle g11快递 PHP 5.5.30
安装包是:
启用OCI8支持 OCI8 DTrace支持已禁用 OCI8版本2.0.8
Oracle运行时客户端库版本11.2.0.4.0 Oracle Compile-time Instant Client版本11.2
我的app \ oracle \ product \ 11.2.0 \ server \ network \ ADMIN
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = GLORY-PC)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
测试代码是:
$conn = oci_connect('hr', 'hr123', 'XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e\['message'\] , ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT * FROM employees');
oci_execute($stid);
echo "
<table border='1'>
\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "
<tr>
\n";
foreach ($row as $item) {
echo "
<td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>
\n";
}
echo "
</tr>
\n";
}
echo "
</table>
\n";
谢谢