0
원격 서버의 Oracle 10g 데이터베이스에서 데이터를 검색하는 데 문제가 있습니다. Linux 데비안 웹 서버에서 PHP를 사용하고 oci8이 활성화되어 작동합니다. 빈 페이지 만 나타납니다. 코드는 다음과 같습니다 :PHP를 사용하여 Oracle 데이터베이스에서 데이터 가져 오기
<?php
$conn = oci_connect('username','password','//server IP address:1521/servicename');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Prepare the statement
$stid = oci_parse($conn, 'SELECT * FROM table');
if (!$stid) {
$e = oci_error($conn);
//trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Perform the logic of the query
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Fetch the results of the query
print "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print "<tr>\n";
foreach ($row as $item) {
print " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : " ") . "</td>\n";
}
print "</tr>\n";
}
print "</table>\n";
oci_free_statement($stid);
oci_close($conn);
?>
서버에 여러 Oracle 데이터베이스가 있으므로 연결하려는 데이터베이스를 명확하게 정의하는 방법을 모르겠습니다.
도움을 주시면 감사하겠습니다.
이 (가) 오류보고 기능을 사용하도록 설정되어 있습니까? 이 오류를 디버그하는 데 도움이되는 오류 메시지가 표시됩니까? – Maximus2012
빈 페이지 만 표시되므로 오류보고가 켜집니다. – Marcus