Oh wise ones...
I have been tasked with rewriting a UNIX script in PERL, so that it will run on an NT box. I am very new to PERL and even newer to DB2. The following code (which works from the db2 cmd line) is what I am basically trying to do:
db2 "LOAD from $INPUT_DIR/product.input \
OF DEL \
MODIFIED BY TIMESTAMPFORMAT=\"YYYY-MM-DD-HH:MM:SS.UUUUUU\" \
SAVECOUNT 1000 \
MESSAGES $OUTPUT_DIR/product.msg \
REPLACE INTO DB2INST1.PRODUCT \
COPY YES TO /dev/null \
WITHOUT PROMPTING \
DATA BUFFER 2000" >> $SQL_LOG
db2 "SET INTEGRITY FOR DB2INST1.PRODUCT IMMEDIATE CHECKED" >> $SQL_LO
+G
What I have so far is...
use DBI;
use Tie::File;
use File::Copy;
my $database='DBI:DB2:game';
my $user='db2admin';
my $password='db2admin';
my $dbh = DBI->connect($database,$user,$password) or die "Can't connec
+t to $database: $DBI::errstr";
my $sth = $dbh->prepare(
q{ load from product.input of DEL modified by timestampformat="YYY
+Y-MM-DD-HH:MM:SS.uuuuuu"
savecount 1000 messages rob.msg replace into db2inst1.product copy
+ yes to d:\data\perl without prompting})
or die "Can't prepare statement: $DBI::errstr";
my $rc = $sth->execute or die "Can't execute statement: $DBI::errstr";
It doesn work....
I get the following message:
DBD::DB2::st execute failed:
IBMCLI DriverDB2/NT SQL0007N The character "\" following "duct copy yes to d:/" is not valid.
SQLSTATE=42601
Can't execute statement:
IBMCLI DriverDB2/NT SQL0007N The character "\" following "duct copy yes to d:/" is not valid. SQL
STATE=42601
Database handle destroyed without explicit disconnect.
I changed my backslashed to / in the code, then I get:
DBD::DB2::st execute failed:
IBMCLI DriverDB2/NT SQL0104N An unexpected token "product" was found following " load from ".
Expected tokens may include: "JOIN". SQLSTATE=42601
Can't execute statement:
IBMCLI DriverDB2/NT SQL0104N An unexpected token "product" was found following " load from ". Exp
ected tokens may include: "JOIN". SQLSTATE=42601
Database handle destroyed without explicit disconnect.
Please Help. I'm lost
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.