Perl et db2 export

Fermé
trinity666 - 15 oct. 2010 à 12:21
Bonjour,

voici ma fonction: pourriez vous m'aider à comprendre pourquoi ca ne marche pas ?

j'importe:
use DBI;
use DBD::DB2::Constants;

voici la fonction qui ne marche pas

sub exportFile #(file_to_export,table)
{
my ($file_to_export, $table)=@_;
my $dbh = db2Connect();
$dbh->do("export to $file_to_export of ixf select * from $table");
db2Close($dbh);
}

avec cette fonction qui marche

sub db2Connect #()
{
my $db_handle = DBI->connect("dbi:DB2:".$conf{'DSN'}, $conf{'USER'}, $conf{'PASSWORD'}) or
die "Can't connect to ".$conf{'DSN'}." database: $DBI::errstr";
traceDebug("DbLib", "Db2 Connection successful");
return $db_handle;
}

je lance la fonction avec cette ligne:

exportFile("./users.ixf","users");

et j'obtiens cette erreur : (alors que ca marche très bien en ligne de commande)

DbLib : Db2 Connection successful
DBD::DB2::db do failed: [IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token
"users" was found following "export to ". Expected tokens may include: "JOIN".
SQLSTATE=42601

merci d'avance