473,395 Members | 1,679 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,395 software developers and data experts.

Data load in DB2

Hi,

my job is converting informix queries to db2.
There is a load function in informix to load the data from flat file to sql file.
Can you please any body help how load function works in db2.

i am using db2 v8.1 version.

please help anybody, its urgent.

Thanks in advance.
Aug 17 '07 #1
10 6330
docdiesel
297 Expert 100+
Hi sai1001,

if you're working on DB2 LUW, you'll find the docs to db2 load at http://publib.boulder.ibm.com/infoce...e/r0008305.htm .
Basically its

Expand|Select|Wrap|Line Numbers
  1. db2 load from myfile.xxx of filetype insert into schema.table
  2.  
where filetype maybe ASC (Text, fixed length), DEL (Text, delimited) or IXF (DB2 interchange format, binary).

Regards,

Bernd
Aug 17 '07 #2
Hi Bernd,
Thanks for your reply. But here I am using db2 command line editor for converting queries from informix to db2.

For below command what you have given me I was trying in db2 command line processor.

Before executing the command , i created one txt file and I created one temp table and I am trying to load the data from txt file to temp table using
the command " db2 load from myfile.xxx of filetype insert into schema.table"

But here I am getting error like ' the remote database does not support the command or one of the command options.
And what is DB2 LUW i don't understand. If you understand my problem please give me a reply.

Thanks



Hi sai1001,

if you're working on DB2 LUW, you'll find the docs to db2 load at http://publib.boulder.ibm.com/infoce...e/r0008305.htm .
Basically its

Expand|Select|Wrap|Line Numbers
  1. db2 load from myfile.xxx of filetype insert into schema.table
  2.  
where filetype maybe ASC (Text, fixed length), DEL (Text, delimited) or IXF (DB2 interchange format, binary).

Regards,

Bernd
Aug 17 '07 #3
docdiesel
297 Expert 100+
Hi sai1001,

well, let's get a fresh start:
  • What version of DB2 are your going to use
  • on what platform (Btw., LUW=Linux, Unixes, Window$)
  • Are you working directly on the server or remotely
  • Where do you place the text data
  • What delimiters do you use
  • Do you have admin access to DB2

If you're working on Linux, put a small amount of rows (up to 10) of your data in a temporary file like /tmp/testdata.txt - in the beginning you'd better work with absolute path and keep time for test cycles short and size of output small.

Regards,

Bernd
Aug 18 '07 #4
Hi Brend,
Thanks for your reply.
Here are my answers to your questions...
[*] What version of DB2 are your going to use ( DB2 v 8.1)[*] on what platform (Btw., LUW=Linux, Unixes, Window$)( On windows)[*] Are you working directly on the server or remotely (working remotely)[*] Where do you place the text data (in our local system)[*] What delimiters do you use ( we use delimiters comma and pipe)[*] Do you have admin access to DB2 (no)[/list]
Note:I want to load the data from text file to sql file.

I will be waiting for your reply.

Thanks
Sai.
Aug 20 '07 #5
can you please anybody help me....
Thanks
sai



Hi,

my job is converting informix queries to db2.
There is a load function in informix to load the data from flat file to sql file.
Can you please any body help how load function works in db2.

i am using db2 v8.1 version.

please help anybody, its urgent.

Thanks in advance.
Aug 20 '07 #6
docdiesel
297 Expert 100+
Hi Sai,

if working remotely, I guess you already have cataloged the DB on your local machine? You can do this using the graphical interface or the db2 command line.

In the following lines I assume that
  • the database is cataloged as REMOTEDB
  • target table is MYSCHEM.MYTABLE
  • the data is placed in c:\temp as file data.txt

Then yout load command in db2cmd command line window should be
Expand|Select|Wrap|Line Numbers
  1. db2 connect to REMOTEDB
  2. db2 load client from c:\temp\data.txt modified by coldel0x7c replace into MYSCHEM.MYTABLE
  3.  
If you're adding data to the table, replace the 'replace' by an 'insert'. The 'client' keyword tells db2 to load from your local client into a remote db.

The coldel0x7c is for pipe ('|', ascii 0x7c) as column delimiter. Maybe you'll have to add a chardel0x2c for the comma (','), but this should be default, as far as I recall.

Hint: If something goes wrong and the content of the table is all in a mess, do a load from an empty file. That's a smart, proper and real quick cleanup.

Good luck,

Bernd
Aug 20 '07 #7
Hi,
Thanks for your reply,
But here I am trying to load the data into a temporary table. Here I am creating the temporary table like this..
ex:
declare global temporary table temp (name char(10)........);

I have a doubt like can i load the data into a temporary table or not?
why am I asking is because I don't have a privilages to create a new table.
and i want to use this temp table in select statement by using join conditions.

Please help


Thanks
Sai


Hi Sai,

if working remotely, I guess you already have cataloged the DB on your local machine? You can do this using the graphical interface or the db2 command line.

In the following lines I assume that
  • the database is cataloged as REMOTEDB
  • target table is MYSCHEM.MYTABLE
  • the data is placed in c:\temp as file data.txt

Then yout load command in db2cmd command line window should be
Expand|Select|Wrap|Line Numbers
  1. db2 connect to REMOTEDB
  2. db2 load client from c:\temp\data.txt modified by coldel0x7c replace into MYSCHEM.MYTABLE
  3.  
If you're adding data to the table, replace the 'replace' by an 'insert'. The 'client' keyword tells db2 to load from your local client into a remote db.

The coldel0x7c is for pipe ('|', ascii 0x7c) as column delimiter. Maybe you'll have to add a chardel0x2c for the comma (','), but this should be default, as far as I recall.

Hint: If something goes wrong and the content of the table is all in a mess, do a load from an empty file. That's a smart, proper and real quick cleanup.

Good luck,

Bernd
Aug 21 '07 #8
docdiesel
297 Expert 100+
Hi Sai,

...
I have a doubt like can i load the data into a temporary table or not?
...
never worked with temp. tables so far. Sorry, can't answer you that one.

Regards,

Bernd
Aug 21 '07 #9
Thanks for your reply.

I have one more question. I am working on windows environment, is the load functions works in windows environment (using command line editor) to load the data in mainframe db2 or not?

I will be waiting for your reply.

Thanks
Sai



Hi Sai,


never worked with temp. tables so far. Sorry, can't answer you that one.

Regards,

Bernd
Aug 22 '07 #10
docdiesel
297 Expert 100+
Hi Sai,

so you're working with DB2 Connect? Hm, as far as I recall it's working the same way as a standard runtime client. The main difference is the ablility to connect to mainframe DB2.

The client side is the same. Therefore I bet it's loading into whatever remote DB you like, whether situated on a Windows, Linux or Mainframe system. Imho there's no reason why it shouldn't.

Regards,

Bernd
Aug 23 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Harshal | last post by:
Hi all, we are trying to load Korean data from a Excel Sheet in to Oracle Database (8.1.7.3 with NLS_LANG=American_America.UTF8) We successfully transferred the Unicode file to our Unix...
1
by: Catch_22 | last post by:
Hi, I'm extracting data from a mainframe application with a view to loading it into a MS SQL database. I'm trying to determine the most efficient way to format the mainframe extract file to make...
4
by: Frank | last post by:
I am loading data through a OleDbDatareader. The load is started from a form by the user, but the actual load is done in a separate class, which is accessed from my form. Now, I want the user to...
6
by: Frank | last post by:
I have made an application that loads data through an OleDbDatareader. I would like the user to be able to interupt the load. Now, I could of course include an interrupt button in the form....
0
by: asheesh.rastogi | last post by:
Hi, I am running DB2 UDB 8.2.4 on AIX 5.3. We are in process of migrating huge chunks of data as part of benchmarking exercise. I need to collect statistics like CPU time and total time taken to...
2
by: Rick Shaw | last post by:
Hi, I have a problem with the datagridview not refreshed when the application first appear on the screen. The datagridview display data from a table in the dataset. At the same time, I've added...
0
by: akp123 | last post by:
Hi I have a flat file with BLOB data that I want to load into DB2 running on AS400 V5R3. I tried to use iSeries navigator import function but it gives me a warning saying I don't have the...
0
by: akp123 | last post by:
Hi I was wondering if anybody knows how to use CPYFRMIMPF command to load BLOB data from a flat file.
5
by: orabalu | last post by:
Hi Guys, Can you give me some examples for Incremental load in PL/SQL for Datawarehouse projects. Regards, Balu
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.