in reply to OT: Failing to export from DB2

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]

Replies are listed 'Best First'.
Re^2: OT: Failing to export from DB2
by talexb (Chancellor) on Mar 31, 2009 at 15:23 UTC

    Thanks for the pointer to DB2::Admin -- it's appreciated, although it appears that your link doesn't work -- the one to CPAN (DB2::Admin) should work. It's unlikely I'll be able to get this installed on a Production server, but it's great to know for the next generation of scripts. :)

    For now, I'm using a shell script to get this job done.

    Updated: To correct link to *DB2* Admin. Sigh. Thanks andreas1234567.

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

      It should be DB2::Admin, not DBI::Admin.
      --
      No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]