php怎么始终连接不上ORACLE啊,有谁能帮帮我啊,phpinfo也显示支持oci8,oracle版本为9.2.0.1.0
<?$dbconn=OCILogon("system","AA123","hymcc");$sql="select*fromoperator_ha";$stmt=OCIP...
<?
$dbconn=OCILogon("system","AA123","hymcc");
$sql ="select * from operator_ha";
$stmt = OCIParse($dbconn, $sql);
if(!$stmt) {
echo "<h1>ERROR - Could not parse SQL statement.</h1>";
exit;
}
OCIExecute($stmt);
while( OCIFetchInto($stmt, &$result_array) )
{
echo
"工号=$result_array[0];姓名=$result_array[1]<BR>";
}
?>
使用sql plus能连接数据库
现在出错提示如下:
Warning: ocilogon() [function.ocilogon]: ORA-12705: Cannot access NLS data files or invalid environment specified in H:\www\OCILogon.php on line 3
Warning: ociparse() expects parameter 1 to be resource, boolean given in H:\www\OCILogon.php on line 5
ERROR - Could not parse SQL statement. 展开
$dbconn=OCILogon("system","AA123","hymcc");
$sql ="select * from operator_ha";
$stmt = OCIParse($dbconn, $sql);
if(!$stmt) {
echo "<h1>ERROR - Could not parse SQL statement.</h1>";
exit;
}
OCIExecute($stmt);
while( OCIFetchInto($stmt, &$result_array) )
{
echo
"工号=$result_array[0];姓名=$result_array[1]<BR>";
}
?>
使用sql plus能连接数据库
现在出错提示如下:
Warning: ocilogon() [function.ocilogon]: ORA-12705: Cannot access NLS data files or invalid environment specified in H:\www\OCILogon.php on line 3
Warning: ociparse() expects parameter 1 to be resource, boolean given in H:\www\OCILogon.php on line 5
ERROR - Could not parse SQL statement. 展开
3个回答
展开全部
我曾经装过10G的php连接ord。
程序运行必须步骤如下
1.安装orl client
2.修改php.ini,打开php_oci.dll等扩展dll
extension=php_pdo_oci.dll
extension=php_pdo_oci8.dll
extension=php_oci8.dll
extension=php_oracle.dll
<?php
@header("Content-Type: text/html; charset=gb2312");
$conn = oci_connect('name', 'pass', 'ordclientdbname','ZHS16GBK');//SIMPLIFIED CHINESE_CHINA.ZHS16GBK AMERICAN.UTF8
if (!$conn) {
$e = oci_error();
print htmlentities($e['message']);
exit;
}
$query = 'SELECT * FROM taobaogoods';
$stid = oci_parse($conn, $query);
if (!$stid) {
$e = oci_error($conn);
print htmlentities($e['message']);
exit;
}
$r = oci_execute($stid, OCI_DEFAULT);
if(!$r) {
$e = oci_error($stid);
echo htmlentities($e['message']);
exit;
}
print '<html><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><body><table border="1">';
$i =0;
while($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {
print '<tr>';
foreach($row as $item) {
// if($i ==3)echo "<script> alert('$item');</script>";
print '<td>'.($item ? $item:' ').'</td>';
//print '<td>'.($item ? iconv('utf-8','gb2312',htmlentities($item)):' ').'</td>';
}
$i++;
//exit;
print '</tr>';
}
print '</table></body></html>';
oci_close($conn);
exit;
程序运行必须步骤如下
1.安装orl client
2.修改php.ini,打开php_oci.dll等扩展dll
extension=php_pdo_oci.dll
extension=php_pdo_oci8.dll
extension=php_oci8.dll
extension=php_oracle.dll
<?php
@header("Content-Type: text/html; charset=gb2312");
$conn = oci_connect('name', 'pass', 'ordclientdbname','ZHS16GBK');//SIMPLIFIED CHINESE_CHINA.ZHS16GBK AMERICAN.UTF8
if (!$conn) {
$e = oci_error();
print htmlentities($e['message']);
exit;
}
$query = 'SELECT * FROM taobaogoods';
$stid = oci_parse($conn, $query);
if (!$stid) {
$e = oci_error($conn);
print htmlentities($e['message']);
exit;
}
$r = oci_execute($stid, OCI_DEFAULT);
if(!$r) {
$e = oci_error($stid);
echo htmlentities($e['message']);
exit;
}
print '<html><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><body><table border="1">';
$i =0;
while($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {
print '<tr>';
foreach($row as $item) {
// if($i ==3)echo "<script> alert('$item');</script>";
print '<td>'.($item ? $item:' ').'</td>';
//print '<td>'.($item ? iconv('utf-8','gb2312',htmlentities($item)):' ').'</td>';
}
$i++;
//exit;
print '</tr>';
}
print '</table></body></html>';
oci_close($conn);
exit;
展开全部
vIIS或者APache服务开了没?
追问
开了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
什么错误你总得贴出来啊,还有你的连接代码随便也贴下啊
追问
ERROR - Could not parse SQL statement.";
exit;
}
OCIExecute($stmt);
while( OCIFetchInto($stmt, &$result_array) )
{
echo
"工号=$result_array[0];姓名=$result_array[1]";
}
?>
页面无显示,用sql plus能连接数据库。
追答
错误信息是什么啊?
$stmt = OCIParse($dbconn, $sql); 这句后面应该是一句执行语句:ociexecute($stmt );
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询