- 论坛徽章:
- 0
|
本帖最后由 hn_weicr 于 2016-12-14 23:12 编辑
xp下就应该下载32位的activeperl。至于DBI等模块,应该用ppm(装好activeperl后,在CMD 下敲ppm就出来)来安装。要学好perl最需要的是不断的思索与折腾。
通过dbi proxyserver来实现也很简单。
./dbiproxy --localport 3333 --mode fork --debug --logfile /dev/tty
Wed Dec 14 22:31:46 2016 debug, Server starting in operation mode fork
Wed Dec 14 22:31:46 2016 notice, Server starting
Wed Dec 14 22:31:56 2016 debug, Connection from 13.71.2.88, port 44020
Wed Dec 14 22:31:56 2016 debug, Child clone: DBI::ProxyServer=HASH(0x3006ba48)
Wed Dec 14 22:31:56 2016 debug, New child starting (DBI::ProxyServer=HASH(0x3006ba48)).
Wed Dec 14 22:31:56 2016 debug, Accepting client from 133.71.24.88, port 44020
Wed Dec 14 22:31:56 2016 debug, Client logs in: Application dbi:Oracle:crmdb1, version 0.2004, user ai_sel
Wed Dec 14 22:31:56 2016 debug, Connecting to dbi:Oracle:crmdb1 as ai_sel
Wed Dec 14 22:31:56 2016 debug, Accepting client
Wed Dec 14 22:31:56 2016 debug, Client executes method Version
Wed Dec 14 22:31:56 2016 debug, Client executes method CallMethod
Wed Dec 14 22:31:56 2016 debug, CallMethod: => DBI::ProxyServer::db=HASH(0x30439ce8),STORE,AutoCommit,1
Wed Dec 14 22:31:56 2016 debug, CallMethod: <= 1
Wed Dec 14 22:31:56 2016 debug, Client executes method CallMethod
Wed Dec 14 22:31:56 2016 debug, CallMethod: => DBI::ProxyServer::db=HASH(0x30439ce8),prepare, SELECT service_num ,subscription_id FROM hiucrm1o.ucs_subscription WHERE ROWNUM<200,,ARRAY(0x3043a028),1
Wed Dec 14 22:31:56 2016 debug, CallMethod: <= DBI::ProxyServer::st=HASH(0x3043a208),2,0,ARRAY(0x3043a438),ARRAY(0x3043a488),0E0
Wed Dec 14 22:31:56 2016 debug, Client executes method CallMethod
Wed Dec 14 22:31:56 2016 debug, CallMethod: => DBI::ProxyServer::st=HASH(0x3043a208),fetch,20
Wed Dec 14 22:31:56 2016 debug, CallMethod: <= ARRAY(0x30439fc8),ARRAY(0x3043a0a8),ARRAY(0x3043a418),ARRAY(0x3043a538),ARRAY(0x3043a578),ARRAY(0x3043a588),ARRAY(0x3043a5c8),ARRAY(0x3043a608),ARRAY(0x3043a648),ARRAY(0x3043a688),ARRAY(0x3043a6c8),ARRAY(0x3043a708),ARRAY(0x3043a748),ARRAY(0x3043a788),ARRAY(0x3043a7c8),ARRAY(0x3043a808),ARRAY(0x3043a848),ARRAY(0x3043a888),ARRAY(0x3043a8c8),ARRAY(0x3043a908)
结果:
13198||5723
13016||576478
13016||576919
13016||56508
130008||80072
1303352||574390
13004630||80647
130162||565541
1309890||5643
13005001||80
130397||800
。。。。。。。。。。。。。。。。
。。。。。。。。。
测试草码(基本上就是仿模块内的测试代码)
$ vi b.pl
use strict;
use DBI;
$ENV{DBI_AUTOPROXY}='dbi:Proxy:hostname=133.2.2.5;port=3333';
my ($dbh,$sth);
my $user = 'ai_sel';
my $pass ='jbjbjbjb';
my $remote="dbi:Oracle:crmdb1";
$dbh = DBI->connect($remote, $user, $pass) ||die "connect did not work: $DBI::errstr";
my $sql = " SELECT service_num ,subscription_id
FROM hiucrm1o.ucs_subscription
WHERE ROWNUM<200";
printf $sql."\n";
$sth=$dbh->prepare($sql);
$sth->execute();
my @ora_cursors=();
while(@ora_cursors=$sth->fetchrow_array)
{
print $ora_cursors[0]."||".$ora_cursors[1]."\n";
}
$sth->finish();
$dbh->disconnect();
|
|