473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

calling DB2 load utility from a C program

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
3 4681
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nick Malik | last post by:
reposting to a wider audience "Nick Malik" <nickmalik@hotmail.nospam.com> wrote in message news:WYONc.203854$XM6.119642@attbi_s53... > My turn to ask a question > > I am working on a plug-in...
3
by: claus.hirth | last post by:
When I execute the following statment using the Command Center it works: LOAD CLIENT FROM 'Y:\\TheFixedWidthData.txt' OF ASC METHOD L ( 1 1,2 11,12 17) REPLACE INTO S00.TheTargetTable...
4
by: Nick Malik | last post by:
My turn to ask a question I am working on a plug-in for Sharepoint that will allow a developer to add workflow rules. One of the rules will inform the adapter that it should load a DLL that the...
2
by: Suresh | last post by:
Hi All I am new to DB2. So i dont have knowledge of DB2 API. I dont have knowledge of how to use API ... I have requirement of loading data from tab delimited text file in to Db2. For this I...
5
by: Konstantin Andreev | last post by:
Recently I became interested, - Are the data, bulk loaded in the table with LOAD utility, consume the same disk space as loaded with IMPORT utility? The answer turned out to be NOT ! Here is a...
1
by: huyuhui | last post by:
The following is a question of LOAD utility. Question: How does the DB2 enforce table check constraints for data added to table with the LOAD utility? A. With the BUILD phase of LOAD B. With the...
0
DTV12345
by: DTV12345 | last post by:
Hello! I have been assigned to bulk-load data into several typed tables of our ODS. I am not clear as to whether it can be done. Here's my homework ===>>> The easy way is to perform INSERT...
4
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages...
0
amitpatel66
by: amitpatel66 | last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations: Concurrent programs can be executed...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.