免费注册 查看新帖 |

Chinaunix

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

perl DBI数据库连接后,怎么做export/import 请教 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-18 11:50 |只看该作者 |倒序浏览
$dbh = DBI->connect("dbiB2m_dbname","d205300","d5passwd";


大家好,我用上面的语句作了db连接之后,用下面的语句去试验可否作export/import,结果似乎跳过下面的语句。也没有报任何错误信息,table中的数据也还存在。兄弟姐妹们,多多指教!谢谢了!
$stmtad2 = "import from /dev/null of del replace into d00009.newbpcust";
$sth2  = $dbh->prepare($stmtad2);
$sth2->execute();


这个测试语句:
$dbh = DBI->connect("dbiB2m_dbname","d205300","d5passwd";
if (!defined($dbh)) {
    &writelog("ERR $0 DB connect Error.";
    goto batch_end;
}
else{
    &writelog("INF $0 DB connect Success.";
}

$stmtad1 = "select count(*) from d00009.newbpcust";
$sth1  = $dbh->prepare($stmtad1);
$sth1->execute();
$n1=$sth1->fetchrow;
&writelog("INF $0 Table newbpcust delete before count= $n1";

$stmtad2 = "import from /dev/null of del replace into d00009.newbpcust";
$sth2  = $dbh->prepare($stmtad2);
$sth2->execute();

$stmtad3 = "select count(*) from d00009.newbpcust";
$sth3  = $dbh->prepare($stmtad3);
$sth3->execute();
$n3=$sth3->fetchrow;
&writelog("INF $0 Table newbpcust delete after count= $n3";

log:
2008-08-18 12:33:21 INF /web/server_root/bin/053/jp/coby/ebpcoby_DB_rec_count.pl DB connect Success.
2008-08-18 12:33:22 INF /web/server_root/bin/053/jp/coby/ebpcoby_DB_rec_count.pl Table newbpcust delete before count= 174
2008-08-18 12:33:22 INF /web/server_root/bin/053/jp/coby/ebpcoby_DB_rec_count.pl Table newbpcust delete after count= 174

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
2 [报告]
发表于 2008-08-19 11:40 |只看该作者
请加上 || die $dbh->errstr;
看看发生什麽事情了...

论坛徽章:
0
3 [报告]
发表于 2008-08-20 10:17 |只看该作者
export/import是db2的命令,不是标准SQL语句,不能在DBI里执行

论坛徽章:
0
4 [报告]
发表于 2008-08-22 13:05 |只看该作者
谢谢各位大侠!

论坛徽章:
0
5 [报告]
发表于 2008-08-24 03:16 |只看该作者
自己写语句导出不行吗?

论坛徽章:
0
6 [报告]
发表于 2008-08-24 10:07 |只看该作者
干嘛搞那么多笑脸啊?

论坛徽章:
0
7 [报告]
发表于 2008-08-24 10:34 |只看该作者

回复 #6 lujx 的帖子

因为发贴的时候没有禁用Smiles

论坛徽章:
0
8 [报告]
发表于 2008-08-24 10:36 |只看该作者
原帖由 forlorngenius 于 2008-8-24 10:34 发表
因为发贴的时候没有禁用Smiles

这样子看得头晕。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP