I am inclined to believe
Anonymous Coward in that the
EXPORT function is not a SQL command, and thus not available through
DBI. I can't get it to work (with
DBI) either:
$dbh->do ("export to table_foo of del select id, str from table_foo");
DBD::DB2::db do failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N
An unexpected token "export to table_foo of del select id,"
was found following "BEGIN-OF-STATEMENT".
Expected tokens may include: "<revoke>". SQLSTATE=42601
However, DB2::Admin works for me (Linux x86_64, DB2 Express-C V.9.5.0, perl v5.10.0):
use strict;
use DB2::Admin;
# use 'perl -s'
our $INST;
our $USER;
our $PASS;
our $TABL;
our $SCHM;
DB2::Admin::->SetOptions('RaiseError' => 1);
DB2::Admin::->Connect(
'Database' => $INST,
'Userid' => $USER,
'Password' => $PASS
);
DB2::Admin->Export(
'Database' => $INST,
'Schema' => $SCHM,
'Table' => $TABL,
'OutputFile' => "/tmp/data-$SCHM-$TABL.del",
'FileType' => 'DEL'
);
__END__
Running:
$ perl -ws admin.pl -INST=TEST -USER=db2inst1 -PASS=***** -SCHM=db2ins
+t1 -TABL=table_foo
$ cat /tmp/data-db2inst1-table_foo.del
1,"foo"
2,"bar"
3,"tze"
Update: Fixed link.
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.