转 perl DBI 总结
https://www.cnblogs.com/homezzm/archive/2011/07/22/2113618.html
##查看已经安装的包
#!/usr/bin/perl
use strict;
use ExtUtils::Installed;
my $inst = ExtUtils::Installed->new();
my @modules = $inst->modules();
foreach (@modules) {
my $ver = $inst->version($_) || "???";
printf("%-22s -Version- %-22s\n", $_, $ver);
}
exit;
————————————————
版权声明:本文为CSDN博主「佼佼者」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/bellwethercoo/article/details/9969899
#####sample
perl 执行mysql 存储过程
生成数据集的MySQL存储过程需要您使用Perl DBD :: mysql 4.001或更高版本. (http://www.perlmonks.org/?node_id=609098)
以下是一个适用于较新版本的测试程序:
mysql> delimiter //
mysql> create procedure Foo(x int)
-> begin
-> select x*2;
-> end
-> //
perl -e 'use DBI; DBI->connect("dbi:mysql:database=bonk", "root", "")->prepare("call Foo(?)")->execute(21)'
但是如果你的DBD :: mysql版本太旧了,你得到的结果如下:
DBD::mysql::st execute failed: PROCEDURE bonk.Foo can't return a result set in the given context at -e line 1.
您可以使用CPAN安装最新的DBD.
###
最近在写perl程序进行数据的采集,perl教程在网上少的可怜呐,至少我找到的资料是很少的。在连接数据库方面下面这个博客写的还是很清晰的,所以就转过来了。
源文地址:http://blog.csdn.net/like_zhz/article/details/5441946
DBI和DBD的不同关系模型:
##########################################################################
可移植的DBI方法:
connect 建立到一个数据库服务器的连接
disconnect 断开数据库服务器的连接
prepare 准备执行一个SQL语句
execute 执行准备好的语句
do 准备并执行一个SQL语句
quote 加引号于要插入的字符串或BLOB值
fetchrow_array 作为一个字段数组取出下一行
fetchrow_arrayref 作为一个字段的引用数组取出下一行
fetchrow_hashref 作为一个哈希表的引用取出下一行
fetchall_arrayref 作为一个字段数组取出所有数据
finish 完成一条语句并且让系统释放资源
rows 返回受影响的行数
data_sources 返回可在localhost上得到的数据库的数组
ChopBlanks 控制fetchrow_*方法是否剥去空格
NUM_OF_PARAMS 在准备的语句中的占位(placeholder-参数)的数目
NULLABLE 其列可以是NULL
trace 执行调试跟踪
##########################################################################
$dbh 数据库句柄
$sth 语句句柄
$rc 返回代码(经常是一个状态)
$rv 返回值(经常是一个行数)
##########################################################################
①connect($data_source, $username, $password)
使用connect方法使得一个数据库连接到数据源。$data_source值应该以DBI:driver_name:开始。以DBD::mysql驱动程序使用connect的例子:
$dbh = DBI->connect("DBI:mysql:$database", $user, $password);
$dbh = DBI->connect("DBI:mysql:$database:$hostname",
$user, $password);
$dbh = DBI->connect("DBI:mysql:$database:$hostname:$port",
$user, $password);
②disconnect
disconnect方法从数据库断开数据库句柄。它一般就在你从程序退出之前被调用。范例:
$rc = $dbh->disconnect;
prepare($statement)
准备一条由数据库引擎执行的SQL语句并且返回语句句柄($sth),你可以使用它调用execute方法。一般地你借助于prepare和execute来处理SELECT语句(和类SELECT语句,例如SHOW、DESCRIBE和EXPLAIN)。范例:
$sth = $dbh->prepare($statement)
or die "Can't prepare $statement: $dbh->errstr/n";
③execute
execute方法执行一个准备好的语句。对非SELECT语句,execute返回受影响的行数。如果没有行受影响,execute返回"0E0",Perl将它视作零而不是真。对于SELECT语句,execute只是在数据库中启动SQL查询;你需要使用在下面描述的fetch_*方法之一检索数据。范例:
$rv = $sth->execute
or die "can't execute the query: $sth->errstr;
④do($statement)
do方法准备并且执行一条SQL语句并且返回受影响的行数。如果没有行受到影响,do返回"0E0",Perl将它视为零而不是真。这个方法通常用于事先无法准备好(由于驱动程序的限制)或不需要执行多次(插入、删除等等)的非SELECT语句。范例:
$rv = $dbh->do($statement)
or die "Can't execute $statement: $dbh- >errstr/n";
⑤quote($string)
quote方法被用来“转义”包含在string中的任何特殊字符并增加所需的外部的引号。范例:
$sql = $dbh->quote($string)
⑥fetchrow_array
这个方法取下一行数据并且作为一个字段值数组返回它。范例:
while(@row = $sth->fetchrow_array) {
print qw($row[0]/t$row[1]/t$row[2]/n);
}
⑦fetchrow_arrayref
这个方法取下一行数据并且作为一个对一个字段值数组的引用返回它。范例:
while($row_ref = $sth->fetchrow_arrayref) {
print qw($row_ref->[0]/t$row_ref->[1]/t$row_ref->[2]/n);
}
⑧fetchrow_hashref
这个方法取一行数据并且返回包含字段名/值对的一个哈希表的一个引用。这个方法不如使用上述数组引用那样有效。范例:
while($hash_ref = $sth->fetchrow_hashref) {
print qw($hash_ref->{firstname}/t$hash_ref->{lastname}/t/
$hash_ref- > title}/n);
}
⑨fetchall_arrayref
这个方法被用来获得从SQL语句被返回的所有数据(行)。它返回一个数组的引用,该数组包含对每行的数组的引用。你用一个嵌套循环来存取或打印数据。范例:
my $table = $sth->fetchall_arrayref
or die "$sth->errstr/n";
my($i, $j);
for $i ( 0 .. $#{$table} ) {
for $j ( 0 .. $#{$table->[$i]} ) {
print "$table->[$i][$j]/t";
}
print "/n";
}
⑩finish
便名没有更多的数据将从这个语句句柄取出。你调用这个方法释放语句句柄和任何与它相关的系统资源。范例:
$rc = $sth->finish;
⑪rows
返回由最后一条命令改变(更新、删除等)的行数。这通常用在非SELECT的execute语句之后。范例:
$rv = $sth->rows;
⑫NULLABLE
返回一个对一个布尔值数组的引用;对数组的每个成员,一个TRUE值表示该列可以包含NULL值。范例:
$null_possible = $sth->{NULLABLE};
⑬NUM_OF_FIELDS
这个属性表明由一条SELECT或SHOW FIELDS语句返回的字段数目。你可以用它检查一条语句是否返回了结果:一个零值表明一个象INSERT、DELETE或UPDATE的非SELECT语句。范例:
$nr_of_fields = $sth->{NUM_OF_FIELDS};
⑭data_sources($driver_name)
这个方法返回一个数组,它包含在主机'localhost'上的MySQL服务器可得到的数据库名。范例:
@dbs = DBI->data_sources("mysql");
⑮ChopBlanks
这个属性确定fetchrow_*方法是否将去掉返回值的头和尾的空白。范例:
$sth->{'ChopBlanks'} =1;
trace($trace_level)
⑯trace($trace_level, $trace_filename)
trace方法开启或关闭跟踪。当作为一个DBI类方法调用时,它影响对所有句柄的跟踪。当作为一个数据库或语句句柄方法调用时,它影响对给定句柄的跟踪(和句柄的未来子孙)。设置$trace_level为2以提供详细的踪迹信息,设置$trace_level为0以关闭跟踪。踪迹输出缺省地输出到标准错误输出。如果指定$trace_filename,文件以添加模式打开并且所有跟踪的句柄的手被写入该文件。范例:
DBI->trace(2); # trace everything
DBI->trace(2,"/tmp/dbi.out"); # trace everything to /tmp/dbi.out
$dth->trace(2); # trace this database handle
$sth->trace(2); # trace this statement handle
你也可以通过设置DBI_TRACE环境变量开启DBI跟踪。将它设置为等价于调用DBI->(value)的数字值,将它设置为等价于调用DBI->(2,value)的路径名。
以上是原文内容。
-----------------------------------------------------------------------------
看了一上午perl,然后用了一下午的时间写了下面的采集(用的时间比较多,呵呵),代码没有抽象,高手轻拍。这个采集百万数据从informix到oracle不到10秒钟。
#!/usr/bin/perl use strict;
use DBI;
use Time::localtime;
use Data::Dumper;
use Time::Local;
use Net::FTP; my ($para); if(@ARGV != 1){
$para = 2;
print "\$para = $para\n";
}else{ $para = $ARGV[0];
print "\$para = $para\n";
} if($para<2){ print "请输入大于等于2的数字!!!\n";
exit;
} my $npmdb_dbh = DBI->connect("DBI:ODBC:npmdb", "informix","*******",{RaiseError=>0,PrintError=>0});
my $gisdb_dbh = DBI->connect("DBI:Oracle:gisdb", "gis","*******",{RaiseError=>1,AutoCommit=>0}); if(!$npmdb_dbh || !$gisdb_dbh)
{
print"数据库联接失败 \n";
}
else
{
$npmdb_dbh->do("set isolation to dirty read");
my $sel_sql = " select a.first_result,a.ne_id,
NVL(CSTRAFFIC_CONV11,0),
NVL(CSTRAFFIC_CONV22,0),
NVL(CSTRAFFIC_CONV55,0),
NVL(TSNBRASSNBRUUL,0),
NVL(TSNBRASSNBRUDL,0),
NVL(BRUUL,0),
NVL(BRUDL,0),
NVL(TDDMAXTCP,0),
NVL(TDDMEANTCP,0),
NVL(NBRERRBLOCKSRECEIVEDCS_CONV55,0),
NVL(NBRBLOCKSRECEIVEDCS_CONV55,0),
NVL(NBRERRBLOCKSRECEIVEDPS,0),
NVL(NBRBLOCKSRECEIVEDPS,0),
NVL(SUCCMACDESTAB,0),
NVL(SUCCRBESTAB,0),
NVL(ATTMACDESTAB,0),
NVL(ATTRBESTAB,0),
NVL(a.ATTRABASSIGNESTABCS_CONV11,0)+NVL(a.ATTRABASSIGNESTABCS_CONV22,0),
NVL(a.SUCCRABASSIGNESTABCS_CONV11,0)+NVL(a.SUCCRABASSIGNESTABCS_CONV22,0),
NVL(a.ATTCONNESTAB_1,0)+NVL(a.ATTCONNESTAB_6,0),
NVL(a.SUCCCONNESTAB_1,0)+NVL(a.SUCCCONNESTAB_6,0) ,
round(NVL(SFB_DIVFLOAT_1(NVL(a.SUCCCONNESTAB_1,0)+NVL(a.SUCCCONNESTAB_6,0),NVL(a.ATTCONNESTAB_1,0)+NVL(a.ATTCONNESTAB_6,0),0,0)*SFB_DIVFLOAT_1(NVL(a.SUCCRABASSIGNESTABCS_CONV11,0)+NVL(a.SUCCRABASSIGNESTABCS_CONV22,0),NVL(a.ATTRABASSIGNESTABCS_CONV11,0)+NVL(a.ATTRABASSIGNESTABCS_CONV22,0),0,0)*100,0),2),
NVL(a.ATTRABASSIGNESTABCS_CONV55,0),
NVL(a.SUCCRABASSIGNESTABCS_CONV55,0),
round(NVL(SFB_DIVFLOAT_1(NVL(a.SUCCCONNESTAB_1,0)+NVL(a.SUCCCONNESTAB_6,0),NVL(a.ATTCONNESTAB_1,0)+NVL(a.ATTCONNESTAB_6,0),0,0)*SFB_DIVFLOAT_1(NVL(a.SUCCRABASSIGNESTABCS_CONV55,0),NVL(a.ATTRABASSIGNESTABCS_CONV55,0),0,0)*100,0),2),
NVL(a.ATTCONNESTAB,0),
NVL(a.SUCCCONNESTAB,0),
NVL(a.ATTRABASSIGNESTABPS,0),
NVL(a.SUCCRABASSIGNESTABPS,0),
round(NVL(SFB_DIVFLOAT_1(a.SUCCRABASSIGNESTABPS,a.ATTRABASSIGNESTABPS,0,0),0)*NVL(SFB_DIVFLOAT_1(a.SUCCCONNESTAB,a.ATTCONNESTAB,0,0),0)*100,2),
NVL(a.NBRRNCRELCSRAB_CONV11,0)+NVL(a.NBRRNCRELCSRAB_CONV22,0),
NVL(a.NBRRABCSRELIUCONN_CONV11,0)+NVL(a.NBRRABCSRELIUCONN_CONV22,0),
round(SFB_DIVFLOAT_1(NVL(a.NBRRNCRELCSRAB_CONV11,0)+NVL(a.NBRRNCRELCSRAB_CONV22,0)+NVL(a.NBRRABCSRELIUCONN_CONV11,0)+NVL(a.NBRRABCSRELIUCONN_CONV22,0),NVL(a.SUCCRABASSIGNESTABCS_CONV11,0)+NVL(a.SUCCRABASSIGNESTABCS_CONV22,0),0,0)*100,2),
NVL(a.NBRRNCRELCSRAB_CONV55,0),
NVL(a.NBRRABCSRELIUCONN_CONV55,0),
round(SFB_DIVFLOAT_1(NVL(a.NBRRNCRELCSRAB_CONV55,0)+NVL(a.NBRRABCSRELIUCONN_CONV55,0),NVL(SUCCRABASSIGNESTABCS_CONV55,0),0,0)*100,2),
NVL(a.NBRRNCRELPSRAB,0)-NVL(a.REL_REQ_PS_16,0)-NVL(a.REL_REQ_PS_40,0),
NVL(a.NBRRABPSRELIUCONN,0),
round(SFB_DIVFLOAT_1(NVL(a.NBRRNCRELPSRAB,0)+NVL(a.NBRRABPSRELIUCONN,0)-NVL(a.REL_REQ_PS_16,0)-NVL(a.REL_REQ_PS_40,0)- NVL(a.RAB_PS_REL_IU_CONN_16,0)-NVL(a.RAB_PS_REL_IU_CONN_40,0),a.SUCCRABASSIGNESTABPS,0,0)*100,2),
NVL(a.NBRBLOCKSRECEIVEDCS_CONV,0),
NVL(a.NBRERRBLOCKSRECEIVEDCS,0),
round(NVL(SFB_DIVFLOAT_1(a.NBRERRBLOCKSRECEIVEDCS_CONV55,a.NBRBLOCKSRECEIVEDCS_CONV55,0,0)*100,0),2),
round(NVL(SFB_DIVFLOAT_1(a.NBRERRBLOCKSRECEIVEDPS,a.NBRBLOCKSRECEIVEDPS,0,0)*100,0),2),
NVL(b.ATTOUTCS,0),
NVL(b.FAILOUTCS,0),
round(SFB_DIVFLOAT_1(NVL(b.ATTOUTCS,0)-NVL(b.FAILOUTCS,0),NVL(b.ATTOUTCS,0),0,0)*100,2),
NVL(b.ATTOUTPSUTRAN,0),
NVL(b.FAILOUTPSUTRAN,0),
round(SFB_DIVFLOAT_1(NVL(b.ATTOUTPSUTRAN,0)-NVL(b.FAILOUTPSUTRAN,0),NVL(b.ATTOUTPSUTRAN,0),0,0)*100,2)
from tpc_utrancell_ne a ,TPC_UTRANCELL_HO_NE b,TPC_UTRANCELL_HSPA_NE c
where a.first_result = current year to hour - $para units hour ||':00:00'
and a.first_result = b.first_result
and a.first_result = c.first_result
and a.ne_id = b.ne_id
and a.ne_id = c.ne_id";
print"$sel_sql\n";
my $rsite = $npmdb_dbh->prepare($sel_sql);
$rsite->execute();
##这个方法被用来获得从SQL语句被返回的所有数据(行)。它返回一个数组的引用,该数组包含对每行的数组的引用
my $ref_data = $rsite->fetchall_arrayref();
$rsite->finish;
$gisdb_dbh->do("delete from BTS_PM_TD where first_result <= sysdate - 74/24");
$gisdb_dbh->do("delete from BTS_PM_TD where first_result = to_date(to_char((sysdate - $para/24),'YYYY-MM-DD HH24'),'SYYYY-MM-DD HH24:MI:SS')"); my $MM = 0;
foreach my $row (@$ref_data)
{
my @data = @$row;
my $dataLen = @data;
my $gisInc = "insert into BTS_PM_TD
values (to_date('$data[0]','SYYYY-MM-DD HH24:MI:SS'),$data[1],";
########### 以下循环拼接SQL
for(my $HH = 2; $HH < $dataLen; $HH++){
$gisInc = $gisInc . "'$data[$HH]',";
}
$gisInc = substr($gisInc,0,length($gisInc) - 1);
$gisInc = $gisInc . " )";
#print"$gisInc \n";
#first_result, ne_id, cstraffic_conv11, cstraffic_conv22, cstraffic_conv55, tsnbrassnbruul, tsnbrassnbrudl, bruul, brudl, tddmaxtcp, tddmeantcp, nbrerrblocksreceivedcs_conv55, nbrblocksreceivedcs_conv55, nbrerrblocksreceivedps, nbrblocksreceivedps, succmacdestab, succrbestab, attmacdestab, attrbestab
$rsite = $gisdb_dbh->do($gisInc);
$MM++;
print "$MM\n";
}
$gisdb_dbh->do("commit"); }
$npmdb_dbh->disconnect();
$gisdb_dbh->disconnect();
exit(0);
more 0_1.perl
use strict;
use DBI;
use Time::localtime;
use Data::Dumper;
use Time::Local;
use Net::FTP;
my ($para);
if(@ARGV != 1){
$para = 2;
print "\$para = $para\n";
}else{
$para = $ARGV[0];
print "\$para = $para\n";
}
if($para<2){
print "请输入大于等于2的数字!!!\n";
exit;
}
more 2.per (oracle)
#!/usr/bin/perl
#perl script used to connect to Oracle
use strict;
use DBI;
my @row ;
my $tnsname="10.241.95.153:1521/eastdb";
my $username="scott";
my $password="tiger";
my $dbh=DBI->connect("dbi:Oracle:$tnsname", $username, $password) or die "Cannot conenct db:
$DBI::errstr\n";
print "I have connected to the Oracle database!\n";
my $sth=$dbh->prepare(" select * from emp " );
$sth->execute();
while (@row = $sth->fetchrow_array()) {
print "row's @row\n"
}
$dbh->disconnect or warn "DB disconnect failed: $DBI::errstr\n";
print "Disconnected from Oracle databae!\n";
more mysql.perl (4.perl)
#!/usr/bin/perl
use DBI;
$user="root";
$passwd='123456';
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=tmp;host=10.241.21.113;port=3306",$user,$passwd) or
die "can't connect todatabase ". DBI-errstr;
$sth=$dbh->prepare("select * from a limit 2");
$sth->execute;
while (@recs=$sth->fetchrow_array) {
print $recs[0].":".$recs[1].":".$recs[2]."\n";
}
$dbh->disconnect;
mysql.perl ( 4_1.perl)
#!/usr/bin/perl
use DBI;
$user="root";
$passwd='123456';
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=tmp;host=10.241.21.113;port=3306",$user,$passwd) or
die "can't connect todatabase ". DBI-errstr;
$sth=$dbh->prepare("select * from a limit 2");
$sth->execute;
while (@recs=$sth->fetchrow_array) {
print $recs[0]."\n";
##begin to insert
my $sth = $dbh->prepare("INSERT INTO b
(b1 )
values
(?)");
$sth->execute($recs[0])
or die $DBI::errstr;
$sth->finish();
$dbh->commit;
}
$dbh->disconnect;
### (4.2 per) 单笔提交效率比较慢,
mysql -> oracle
##soruce
use DBI;
$user="root";
$passwd='123456';
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=tmp;host=10.241.21.113;port=3306",$user,$passwd) or
die "can't connect todatabase ". DBI-errstr;
$sth=$dbh->prepare("select * from a limit 2");
$sth->execute;
while (@recs=$sth->fetchrow_array) {
print $recs[0]."\n";
##target
my @row ;
my $tnsname="10.241.95.153:1521/eastdb";
my $username="scott";
my $password="tiger";
my $dbh_o=DBI->connect("dbi:Oracle:$tnsname", $username, $password) or die "Cannot conenct db:
$DBI::errstr\n";
print "I have connected to the Oracle database!\n";
my $sth=$dbh_o->prepare(" INSERT INTO O
(O1 )
values
(?) " );
$sth->execute($recs[0])
or die $DBI::errstr;
$sth->finish();
$dbh_o->commit;
$dbh_o->disconnect or warn "DB disconnect failed: $DBI::errstr\n";
print "Disconnected from Oracle databae!\n";
}
$dbh->disconnect;
### (4.4 per) 采用bulk 导入导出,测试环境 10.241.95.153
mysql -> oracle
mysql -> oracle
##soruce
use DBI;
$user="root";
$passwd='123456';
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=tmp;host=10.241.21.113;port=3306",$user,$passwd) or
die "can't connect todatabase ". DBI-errstr;
##target
my @row ;
my $tnsname="10.241.95.153:1521/eastdb";
my $username="scott";
my $password="tiger";
my $dbh_o=DBI->connect("dbi:Oracle:$tnsname", $username, $password) or die "Cannot conenct db:
$DBI::errstr\n";
print "I have connected to the Oracle database!\n";
##get data from database tmp table a
$sth=$dbh->prepare("select * from a");
$sth->execute;
my $ref_data = $sth->fetchall_arrayref();
$sth->finish;
##begin to insert table scott.o
my $MM = 0;
foreach my $row (@$ref_data)
{
my @data = @$row;
my $dataLen = @data;
my $gisInc = "insert into o
values ('$data[0]')";
$rsite = $dbh_o->do($gisInc);
}
$dbh_o->do("commit");
$dbh_o->disconnect();
$dbh->disconnect();
##########存储过程采集数据 发送到 oracle
mysql 存储过程
##soruce 1_1.perl
use DBI;
$user="root";
$passwd='123456';
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=tmp;host=10.241.21.113;port=3306",$user,$passwd) or
die "can't connect todatabase ". DBI-errstr;
$sth=$dbh->prepare("CALL foo(?)");
$sth->execute(2);
my $ref_data = $sth->fetchall_arrayref();
$sth->finish;
##same with ->prepare("call Foo(?)")->execute(21)' mysql client with command call Foo(2);
###简单的存储过程可以处理,如果是复杂的存贮过程,比如分别从2张不同的表,查到数据。perl 执行就会抱错
##:DBI::db=HASH(0x812938)->disconnect invalidates 1 active statement handle
mysql 存储过程-> oracle
##soruce 1_2.perl
use DBI;
$user="root";
$passwd='123456';
$dbh="";
$dbh = DBI->connect("dbi:mysql:database=tmp;host=10.241.21.113;port=3306",$user,$passwd) or
die "can't connect todatabase ". DBI-errstr;
##target
my @row ;
my $tnsname="10.241.95.153:1521/eastdb";
my $username="scott";
my $password="tiger";
my $dbh_o=DBI->connect("dbi:Oracle:$tnsname", $username, $password) or die "Cannot conenct db:
$DBI::errstr\n";
print "I have connected to the Oracle database!\n";
##get data from database tmp table a
$sth=$dbh->prepare("CALL foo(?)");
$sth->execute(2);
my $ref_data = $sth->fetchall_arrayref();
$sth->finish;
##begin to insert table scott.o1
my $MM = 0;
foreach my $row (@$ref_data)
{
my @data = @$row;
my $dataLen = @data;
my $gisInc = "insert into o1
values ('$data[0]')";
$rsite = $dbh_o->do($gisInc);
}
$dbh_o->do("commit");
$dbh_o->disconnect();
$dbh->disconnect();
转 perl DBI 总结的更多相关文章
- perl DBI 学习总结(转载)
perl DBI 学习总结 源文地址:http://blog.csdn.net/like_zhz/article/details/5441946 DBI和DBD的不同关系模型: ########### ...
- PERL DBI 自动重连问题
[root@wx03 mojo]# cat relink.pl use Mojolicious::Lite; use JSON qw/encode_json decode_json/; use Enc ...
- perl dbi 测试 mysql wait_timeout
The number of seconds the server waits for activity on a noninteractive connection before closing it ...
- Linux安装DBI/DBD-ORACLE
本文只是学习如何配置PERL DBI.PERL DBD时,整理的一个学习实践文档,大部分参考网上资料,详情请见下面参考资料. PERL对数据库的支持广而且全,几乎所有的主流数据库都有与之相应的PERL ...
- linux centos环境下,perl使用DBD::Oracle遇到报错Can't locate DBD/Oracle.pm in @INC 的解决办法
前言 接手前辈的项目,没有接触.安装.使用过perl和DBD::Oracle,也没有相关的文档记录,茫茫然不知所措~~.一开始发现这个问题,就想着迅速解决,就直接在google上搜报错信息,搜索的过程 ...
- Perl系列文章
0.Perl书籍推荐 Perl书籍下载 密码:kkqx 下面是一些我学习Perl过程中读过完整的或部分章节的觉得好的书. 入门级别1:<Perl语言入门>即小骆驼 入门级别2:<In ...
- 雷林鹏分享:Ruby 数据库访问 - DBI 教程
Ruby 数据库访问 - DBI 教程 本章节将向您讲解如何使用 Ruby 访问数据库.Ruby DBI 模块为 Ruby 脚本提供了类似于 Perl DBI 模块的独立于数据库的接口. DBI 即 ...
- Mysql字符转义
在字符串中,某些序列具有特殊含义.这些序列均用反斜线('\')开始,即所谓的转义字符.MySQL识别下面的转义序列: \0 ASCII 0(NUL)字符. \' 单引号('''). \" 双 ...
- 在RedHat上安装gcc,java 和 eclipse-rcp
本文全是如何用rpm包在红帽子54上安装gcc,automake,java和eclipse等,不是源代码编译,请大家不要误会了. 其实通过rpm包安装东西很简单,麻烦的是有很多rpm是要根据顺序进行先 ...
随机推荐
- webapi之owin的oauth2.0密码模式_01概述
一般在webapi接口中,为了防止接口被随意调用,都会验证用户身份. 然而不能每次调用接口都需要用户输入用户名密码来验证,这时就需要授权颁发令牌了,持有令牌就可以访问接口,接口也能验证令牌身份. 简单 ...
- 史上最完整promise源码手写实现
史上最完整的promise源码实现,哈哈,之所以用这个标题,是因为开始用的标题<手写promise源码>不被收录 promise自我介绍 promise : "君子一诺千金,承诺 ...
- charAt,charCode,fromCharCode区别
1.charAt 返回字符串指定位置的字符 2.charCode 返回字符串指定位置字符Unicode编码 3.fromCharCode 用Unicode编码创建字符串 我们来看下例子 var str ...
- GoLand——配置goproxy.io代理
前言 由于众所周知的原因,也为了更好的下载go的包,所以找到了goproxy 配置 ctrl+alt+s->Go->Go Modules(vgo)->设置proxy为https:// ...
- GitLab CI runner can't connect to tcp://localhost:2375 in kubernetes
报错的.gitlab-ci.yml配置如下 image: docker:latest services: - docker:dind variables: DOCKER_HOST: tcp://loc ...
- xshell连接不上阿里云服务器Could not connect to 'ip' (port 22): Connection failed.解决过程
记一次xshell阿里云服务器突然连接不上的解决办法: 1, 确认阿里云服务器安全组出入都有22,百度出来都说的这个和ip拦截设置,以防万一都设置了:但楼主设置后,还是连不上服务器: 只好下一步 2, ...
- 对象key值排序,以key值(数字)大小顺序遍历属性,helper._sort()
var helper = { _sort:function(data){ //{“20141216”:{},“20141217”:{}}按大小排序, var arr1 = [],arr2=[]; fo ...
- nginx 配置文件正确性测试
今日思语:每天都要不一样,那么每天就应该多学习 在安装完nginx之后,我们可以使用nginx的测试命令来验证下nginx.conf的配置是否正确: 方式一:不指定文件 nginx -t 如上可知/e ...
- 转储Active Directory数据库
获取Windows域控所有用户hash: 参考:3gstudent 方法1: 复制ntds.dit: 使用NinjaCopy,https://github.com/3gstudent/NinjaCop ...
- Codeforces Round #605 (Div. 3) B. Snow Walking Robot(构造)
链接: https://codeforces.com/contest/1272/problem/B 题意: Recently you have bought a snow walking robot ...