- 论坛徽章:
- 0
|
初次用dbi 连接oracle(已安装dbd::oracle 及oracle客户端,sql*plus能正常工作了)
代码
#! /usr/bin/perl
use warnings;
use strict;
use DBI;
$ENV{"NLS_LANG"} = 'AMERICAN_AMERICA.ZHS16GBK';
$ENV{"ORACLE_HOME"} = 'C:\oracle\ora81';
my $user_id='user_name';
my $passwd='my_pass';
my $dbh = DBI->connect("dbi:Oracle:host=10.243.11.11;sid=test",
$user_id
$passwd
) || die "can NOT connect";
my $sql = 'select * from bb_service_t WHERE user_id=5538';
my $sth = $dbh->prepare($sql);
$sth->execute();
$dbh->disconnect();
提示如下:
无法定位程序输入点OCINlsEnvironmentVariableGet于动态链接库OCI.dll上。
install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:找不到指定的程序。 at C:/Perl/lib/Dyna
Loader.pm line 229. at (eval 4) line 3
Compilation failed in require at (eval 4) line 3. Perhaps a required shared library or dll isn't installed where expected
at test.pl line 10
,请各位帮忙看看。
[ 本帖最后由 weicr 于 2008-2-18 14:36 编辑 ] |
|