php如何读oracle phporacle 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 需要安装 oracle11g 的客户端因为自 oracle 9 起,他的客户端就单独发行了,php 已经没有必要将客户端捆绑进来所以只提供了与客户端通讯的接口 php_oci8 和 php_oci8_11g由于 oracle11g 的客户端做了很大的改动,因此才有 php_oci8_11g 与之连接,主要是为了使用 oracle 的新功能 谢谢这位大神,本人小白,基本是按着这篇文章安装的64位oraclehttp://blog.sina.com.cn/s/blog_868ba3570101djuh.html搞了32位的客户端,但是他提到的 tnsnames.ora 这个文件我在%Oracle_Home%\NETWORK\ADMIN下面没有找到。请问然后我该怎么办呢? 你看看这个 http://download.csdn.net/download/eisjmo/4362471 很长时间没有弄了,细节都记不清了不过映像中只要 setup 就可以了,没有什么需要配置的 现在有了新情况,我简单测试下连接数据库,报 Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in C:\xampp\htdocs\phpwork1\test.php on line 17ORA-12154: TNS:could not resolve the connect identifier specified环境变量也配了,不好使 <?php $conn = oci_connect('system', '123456', 'aaa');if (!$conn) { $e = oci_error(); print htmlentities($e['message']); exit;}$query = 'SELECT * FROM DEPARTMENTS';//编译SQL语句:函数:oci_parse()$stid = oci_parse($conn, $query);if (!$stid) { $e = oci_error($conn); print htmlentities($e['message']); exit;}//执行SQL语句:函数:oci_execute();$r = oci_execute($stid, OCI_DEFAULT);if(!$r) { $e = oci_error($stid); echo htmlentities($e['message']); exit;}print '<table border="1">';while($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) { print '<tr>'; foreach($row as $item) { print '<td>'.($item?htmlentities($item):' ').'</td>'; } print '</tr>';}print '</table>';oci_close($conn);?>就是php手册里的一段 谢谢大神,我用pdo返回差不多的信息 SQLSTATE[42S02]: pdo_oci_handle_factory: ORA-12154: TNS:could not resolve the connect identifier specified (ext\pdo_oci\oci_driver.c:633) 代码 $tns="aaa";try{ $conn=new PDO("oci:dbname=".$tns, 'system', '123456');}catch(PDOException $e){ echo ($e->getMessage());}此外为何我PDO_OCI下毛也没有呢 php.ini里已经启动了extension=php_pdo_oci.dll $db = new PDO('oci:dbname=//机器名或ip:1521/实例名', '用户名', '口令');$rs = $db->query('sql指令' ); 关于点击刷新验证码的问题 如何判断MySQL里的某个数据库是否存在呢? php共享内存可否共享资源 Got error 127 from storage engine 大家看下我这样分区可以吗 phpcms2008sp4采集功能问题 php+iis 陪之后出现 CGI Error 是怎么回事???? 这个程序错在那里,帮我一下~! 为Symfony2和Redis正名,基于PHP的10亿请求/周网站打造 关于pdo引用传参,字段是不是不能当成参数传入? 请给我解释下这个服务器描述语言是什么意思?? 怎么取得select下拉框的值?
所以只提供了与客户端通讯的接口 php_oci8 和 php_oci8_11g
由于 oracle11g 的客户端做了很大的改动,因此才有 php_oci8_11g 与之连接,主要是为了使用 oracle 的新功能
http://blog.sina.com.cn/s/blog_868ba3570101djuh.html
搞了32位的客户端,但是他提到的 tnsnames.ora 这个文件我在%Oracle_Home%\NETWORK\ADMIN下面没有找到。请问然后我该怎么办呢?
不过映像中只要 setup 就可以了,没有什么需要配置的
ORA-12154: TNS:could not resolve the connect identifier specified
环境变量也配了,不好使
if (!$conn) {
$e = oci_error();
print htmlentities($e['message']);
exit;
}$query = 'SELECT * FROM DEPARTMENTS';//编译SQL语句:函数:oci_parse()
$stid = oci_parse($conn, $query);
if (!$stid) {
$e = oci_error($conn);
print htmlentities($e['message']);
exit;
}//执行SQL语句:函数:oci_execute();
$r = oci_execute($stid, OCI_DEFAULT);
if(!$r) {
$e = oci_error($stid);
echo htmlentities($e['message']);
exit;
}print '<table border="1">';
while($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) {
print '<tr>';
foreach($row as $item) {
print '<td>'.($item?htmlentities($item):' ').'</td>';
}
print '</tr>';
}
print '</table>';oci_close($conn);?>
就是php手册里的一段
SQLSTATE[42S02]: pdo_oci_handle_factory: ORA-12154: TNS:could not resolve the connect identifier specified (ext\pdo_oci\oci_driver.c:633)
代码
$tns="aaa";
try{
$conn=new PDO("oci:dbname=".$tns, 'system', '123456');
}catch(PDOException $e){
echo ($e->getMessage());
}
此外为何我PDO_OCI下毛也没有呢 php.ini里已经启动了extension=php_pdo_oci.dll
$rs = $db->query('sql指令' );