By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,206 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

calling DB2 load utility from a C program

P: n/a
Hi,

I am trying to execute the DB2 load utility from a C program.

lPid = fork();

execl(csExePath, csExeName,csCmd, NULL);

the contents of the parameter variables are as follows:-

csExePath:- /home/db2dcln/sqllib/bin/db2

csExeName:-

csCmd:- 'LOAD FROM /Test/log/193.37.6.18.PRE.err OF del MODIFIED BY
COLDEL| DUMPFILE=/Test/bad/193.37.6.18.myfile.ERR_LOAD.bad MESSAGES
193.37.6.18.myfile.ERR_LOAD.log INSERT INTO ERROR_MSG'

Also tried with csExeName='db2'

The connection to DB2 is taken in the program using EXEC SQL DB2
connect to user myuserid using mypassword
The command doesn't seem to be running successfully because the '.log'
and '.bad' file do not get created and the table is also not
populated.

The same command(mentioned as follows) seems to be running from the
command prompt. (We are using DB2 on AIX )
$>/home/db2dcln/sqllib/bin/db2 'LOAD FROM
/Test/log/193.37.6.18.PRE.err OF del MODIFIED BY COLDEL|
DUMPFILE=/Test/bad/193.37.6.18.myfile.ERR_LOAD.bad MESSAGES
193.37.6.18.myfile.ERR_LOAD.log INSERT INTO ERROR_MSG'

What can the problem be ? Why isn't it running from the C program?
Thanks in advance

Arti
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Instead of invoking the LOAD command by calling out to the execuatable
why don't you just use the DB2 Load C API....

Scott
ar******@yahoo.com (Arti Potnis) wrote in message news:<ec**************************@posting.google. com>...
Hi,

I am trying to execute the DB2 load utility from a C program.

lPid = fork();

execl(csExePath, csExeName,csCmd, NULL);

the contents of the parameter variables are as follows:-

csExePath:- /home/db2dcln/sqllib/bin/db2

csExeName:-

csCmd:- 'LOAD FROM /Test/log/193.37.6.18.PRE.err OF del MODIFIED BY
COLDEL| DUMPFILE=/Test/bad/193.37.6.18.myfile.ERR_LOAD.bad MESSAGES
193.37.6.18.myfile.ERR_LOAD.log INSERT INTO ERROR_MSG'

Also tried with csExeName='db2'

The connection to DB2 is taken in the program using EXEC SQL DB2
connect to user myuserid using mypassword
The command doesn't seem to be running successfully because the '.log'
and '.bad' file do not get created and the table is also not
populated.

The same command(mentioned as follows) seems to be running from the
command prompt. (We are using DB2 on AIX )
$>/home/db2dcln/sqllib/bin/db2 'LOAD FROM
/Test/log/193.37.6.18.PRE.err OF del MODIFIED BY COLDEL|
DUMPFILE=/Test/bad/193.37.6.18.myfile.ERR_LOAD.bad MESSAGES
193.37.6.18.myfile.ERR_LOAD.log INSERT INTO ERROR_MSG'

What can the problem be ? Why isn't it running from the C program?
Thanks in advance

Arti

Nov 12 '05 #2

P: n/a
sp******@yahoo.com wrote in message news:<4c**************************@posting.google. com>...
Instead of invoking the LOAD command by calling out to the execuatable
why don't you just use the DB2 Load C API....

Scott
ar******@yahoo.com (Arti Potnis) wrote in message news:<ec**************************@posting.google. com>...
Hi,

I am trying to execute the DB2 load utility from a C program.

lPid = fork();

execl(csExePath, csExeName,csCmd, NULL);

the contents of the parameter variables are as follows:-

csExePath:- /home/db2dcln/sqllib/bin/db2

csExeName:-

csCmd:- 'LOAD FROM /Test/log/193.37.6.18.PRE.err OF del MODIFIED BY
COLDEL| DUMPFILE=/Test/bad/193.37.6.18.myfile.ERR_LOAD.bad MESSAGES
193.37.6.18.myfile.ERR_LOAD.log INSERT INTO ERROR_MSG'

Also tried with csExeName='db2'

The connection to DB2 is taken in the program using EXEC SQL DB2
connect to user myuserid using mypassword
The command doesn't seem to be running successfully because the '.log'
and '.bad' file do not get created and the table is also not
populated.

The same command(mentioned as follows) seems to be running from the
command prompt. (We are using DB2 on AIX )
$>/home/db2dcln/sqllib/bin/db2 'LOAD FROM
/Test/log/193.37.6.18.PRE.err OF del MODIFIED BY COLDEL|
DUMPFILE=/Test/bad/193.37.6.18.myfile.ERR_LOAD.bad MESSAGES
193.37.6.18.myfile.ERR_LOAD.log INSERT INTO ERROR_MSG'

What can the problem be ? Why isn't it running from the C program?
Thanks in advance

Arti


---------------------------------------------
I guess the problem is that execl runs the LOAD command in the child
shell and the db connection does not exist here.

Are there any performance issues with the load API. If I were to load
millions of records say file sizes in GB, what would be the
performance difference in using the load api as opposed to using the
LOAD command directly.

thanks
Arti
Nov 12 '05 #3

P: n/a
Ian
Arti Potnis wrote:
I guess the problem is that execl runs the LOAD command in the child
shell and the db connection does not exist here.

Are there any performance issues with the load API. If I were to load
millions of records say file sizes in GB, what would be the
performance difference in using the load api as opposed to using the
LOAD command directly.


I can't say this for sure, but I'd bet that the LOAD command calls the
load API. So, no performance difference, if you use the same options.

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.