Re: Can we use DBI to import data into a table?

[email protected] (Ovid)
Newsgroups perl.dbi.users
Message-ID <[email protected]>
----- Original Message ----
> From: "Song, Melinda" <[email protected]>


> I am using DBI to connect to a DB2 LUW database. It seems I cannot use DBI to 
> issue the IMPORT command.

> my $dbh = DBI->connect( 
> "dbi:MSDB2:$DB_NAME", '', '', { 'RaiseError' => 1 } );
> dbh->do("import 
> from $filename of del insert into $tabname");

> DBD::MSDB2::db do failed: 
> [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N  An unexpected token "import" 
> was found following "BEGIN-OF-STATEMENT".  Expected tokens may 
> include:  "<values>".  SQLSTATE=42601

Hi Melinda,

I was surprised to see that there was an MSDB2 driver, but Google suggests that this is a Morgan Stanley subclass of the DB2 driver.  That makes this harder to debug.  You may have to contact whoever wrote DBD::MSDB2, but I can't say I know DBI internals well enough to know if that's a reasonable route.

Googling for your exact error returns limited results, but I see that others get this result without DBI:

    http://www.dbforums.com/db2/1618417-truncate-table-db2.html

That suggests that an older version of DB2 might be involved, but it's a different route taken to reach that error, so again, I've no idea if that's relevant.

Sorry I can't be of more help.

Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://blogs.perl.org/users/ovid/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.