免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6314 | 回复: 8
打印 上一主题 下一主题

求助!!! perl下如何实现连接WINDOW环境下 ORACLE 数据库 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-06-13 11:06 |只看该作者 |倒序浏览
需要安装哪里包文件 求正式实现过的大大们指点下

论坛徽章:
0
2 [报告]
发表于 2006-06-14 18:31 |只看该作者
dbd
dbi-oracle

论坛徽章:
0
3 [报告]
发表于 2006-06-15 18:27 |只看该作者
包都装了..我也折腾了一天也没连到数据库!!汗...期待各位大侠指点!!
都报这个错...
郁闷了..
DBI connect('host=192.168.1.2;sid=yyrtest','ivruser',...) failed: ERROR OCINlsEn
vironmentVariableGet(OCI_NLS_CHARSET_ID) Check ORACLE_HOME and NLS settings etc.
at D:\workspace\DBI\GetuserInfo.pl line 22

[ 本帖最后由 lyrix_z 于 2006-6-15 18:40 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-06-16 16:31 |只看该作者
你的 版本 及 設定可能有問題
我的方式是
        $dbh = DBI->connect("DBI:Oracle:$oracle_env{'sid'}","$oracle_env{'username'}","$oracle_env{'password'}");
        $sql = qq{
                                select c.tablespace_name,round(a.bytes/1048576) Megs_Alloc,round(b.bytes/1048576) Megs_Free,round((a.bytes-b.bytes)/1048576) Megs_Used
                                from (select tablespace_name,sum(a.bytes) bytes,min(a.bytes) minbytes,max(a.bytes) maxbytes
                                      from sys.dba_data_files a
                                      group by tablespace_name) a,(select a.tablespace_name,nvl(sum(b.bytes),0) bytes
                                                                                               from sys.dba_data_files a,sys.dba_free_space b
                                                                                               where a.tablespace_name = b.tablespace_name (+) and a.file_id = b.file_id (+)
                                                                                               group by a.tablespace_name) b,sys.dba_tablespaces c,(select tablespace_name,count(distinct segment_name) num_segs,count(extent_id) num_exts
                                                                                                                                                                                                            from sys.dba_extents
                                                                                                                                                                                                            group by tablespace_name) d
                                where a.tablespace_name = b.tablespace_name(+) and a.tablespace_name = c.tablespace_name and a.tablespace_name = d.tablespace_name(+)
                                order by c.tablespace_name
                        };
        eval{
                $sth = $dbh->prepare( $sql );
                $sth->execute();
                $sth->bind_columns(\$GetTablespaceName,\$GetMegaAlloc,\$GetMegaFree,\$GetMegaUse);
                while( $sth->fetch() ) {
                        push(@Tablespace_Temp,"$GetTablespaceName,$GetMegaUse,$GetMegaFree,$GetMegaAlloc\n");
                }
                $sth->finish();
                $dbh->disconnect();
        };

ppm> query dbd
Querying target 1 (ActivePerl 5.8.4.810)
  1. DBD-Oracle9 [1.16]
ppm> query dbi
Querying target 1 (ActivePerl 5.8.4.810)
  1. DBI [1.45]9i Client

還有你要check 你的 tnsnames.ora 有沒有 設定對

[ 本帖最后由 ieting 于 2006-6-18 16:47 编辑 ]

论坛徽章:
0
5 [报告]
发表于 2006-07-10 14:39 |只看该作者

请问 在不装ORACLE 的情况下是不是能够将 DBD-ORACLE9装上

请问 在不装ORACLE 的情况下是不是能够将 DBD-ORACLE9装上

论坛徽章:
0
6 [报告]
发表于 2006-07-10 14:40 |只看该作者

我装时候 它是提示找不到ORACLE环境变量的

我装时候 它是提示找不到ORACLE环境变量的

论坛徽章:
0
7 [报告]
发表于 2007-09-19 14:33 |只看该作者
$dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid", $user, $passwd);


DBI connect('host=192.168.0.6;sid=cssdb','confluence',...) failed: ERROR OCINlsEnvironmentVariableGet(OCI_NLS_CHARSET_ID) Check ORACLE_HOME and NLS settings etc. at C:\temp\perltest\or.pl line 11

等待解决方案

论坛徽章:
0
8 [报告]
发表于 2007-09-19 16:47 |只看该作者
$dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid", $user, $passwd);

直接改成 $dbh = DBI->connect("dbi:Oraclesid;$host", $user, $passwd);

论坛徽章:
0
9 [报告]
发表于 2014-06-27 15:11 |只看该作者
你后来怎么解决的?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP