IMPORT is not a valid SQL statement. You need to execute it as an
external (OS) command.

--- Andy Nguyen <[EMAIL PROTECTED]> wrote:
> Hi
> 
>     I had a problem using Perl scripts to import text
> file into DB2 database.  Could someone helps me to get
> over this problem.  One of my projects I am working on
> needs to import text file in to database.
> 
>     I had DB2 Enterprise Edition Version 8  and Active
> Perl Version 5.8 installed in my computer.  When I
> used Perl scripts to execute the DB2's sql statement
> such as select, create table, update .... I got no
> problem at all, but I got a problem to import text
> file into DB2 database.  The syntax looks like this.
> 
> #! c:\perl\bin\perl
> 
> use DBI;
> 
> $dbi_Driver = "ODBC";
> $dbi_DBName = "MyDatabase";
> $user = "username";
> $pwd = "password";
> 
> $dbh = DBI->connect
> 'dbi:'.$dbi_Driver.':'.$dbi_DBName,$user,
> $pwd,{RaiseError => 1, PrintError => 1}) || die
> "unable to make a database connection open DB";
> 
> 
> $sql = "import from c:/person.txt of del insert into
> person";
> 
> $sth = $dbh->prepare($sql);
> $sth->execute();
> $sth->finish();
> 
>  When I executed the sql statement "import from
> c:/person.txt of del insert into person" at the DB2
> Command Line Processor, I did not get any problem at
> all.  But it raised an error when I used Perl Script
> to execute this sql statement.  The error looks like
> this
> 
> DBD::DB2::st execute failed: [IBM][CLI Driver][DB2/NT]
> SQL0104N  An unexpected token "import from
> c:/person.txt of del" was found following
> "BEGIN-OF-STATEMENT".  Expected tokens may include: 
> "".  SQLSTATE=42601
> 
> Please help, any input would be appriciated.
> 
> Thanks a lot
> 
> Dung Nguyen
> 
> =====
> [EMAIL PROTECTED]
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Reply via email to