473,791 Members | 3,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

import XML file into DB2 table

Hi all,

I have 6 tables inside a MS Access 2003 mdb file.

I want to convert them as DB2 version -8 tables in AIX 5.2.

I have exported them as 6 XML files.

The XML files look fine.
Each record is embeded by a tag which is the table name.
Then, each column is embeded by a tag which is the column name.
Even memo fields are represented as multi-lines within its tag.

Each whole file just looks like a table of m x n cells, nice and neat.

However, after I transfer the XML files into AIX for DB2 importing,
it seems to me that DB2 has no such an importing option for XML.

There are options for IXF, DEL (i.e. CSV), ... etc but seems not for
XML.

Does anyone has similar experience ?

Does anyone know know to import that XML file into a table in DB2 ?

Thanks in advance.
Alvin SIU
Jun 27 '08 #1
4 10328
On Jun 22, 7:45*am, Alvin SIU <alvin....@gmai l.comwrote:
Hi all,

I have 6 tables inside a MS Access 2003 mdb file.

I want to convert them as DB2 version -8 tables in AIX 5.2.

I have exported them as 6 XML files.

The XML files look fine.
Each record is embeded by a tag which is the table name.
Then, each column is embeded by a tag which is the column name.
Even memo fields are represented as multi-lines within its tag.

Each whole file just looks like a table of m x n cells, nice and neat.

However, after I transfer the XML files into AIX for DB2 importing,
it seems to me that DB2 has no such an importing option for XML.

There are options for IXF, DEL (i.e. CSV), ... etc but seems not for
XML.

Does anyone has similar experience ?

Does anyone know know to import that XML file into a table in DB2 ?

Thanks in advance.
Alvin SIU
hi,

there is no xml-import option.
if you want to use xml as transfer-tool then you have to use the xml-
extender on the db2 side.

cu

ferdinand
Jun 27 '08 #2
If it's a one time thing I'd recommend writing a VBA Macro in MS
Access that loops through the rows in the tables and writes a SQL
INSERT statement for each row of the table to disk.

Then execute the SQL statements in that file.

If you don't want to use VBA then you could read the XML file in your
favorite programming language and similarly create an output-script
file of INSERT statements.
Jun 27 '08 #3
Alvin SIU wrote:
Hi all,

I have 6 tables inside a MS Access 2003 mdb file.

I want to convert them as DB2 version -8 tables in AIX 5.2.
The XML support in DB2 8 is rather sparse (quite a bit for generating
XML from tables, but not for parsing or importing it - that stuff was
added in DB2 9).
I have exported them as 6 XML files.

The XML files look fine.
Each record is embeded by a tag which is the table name.
Then, each column is embeded by a tag which is the column name.
Even memo fields are represented as multi-lines within its tag.

Each whole file just looks like a table of m x n cells, nice and neat.

However, after I transfer the XML files into AIX for DB2 importing,
it seems to me that DB2 has no such an importing option for XML.

There are options for IXF, DEL (i.e. CSV), ... etc but seems not for
XML.
IXF, delimited (CSV), and fixed-width text files each represent tables
of data (columns and rows). XML files represent a tree hierarchy of
information. A table-like structure as you describe is merely a
"special case" - moreover there are multiple ways of specifying such a
table-like structure in XML (attributes or elements for columns, does
ordering matter or are columns matched by name, if using elements, do
the element tags name the columns or are attributes used for this, if
using attributes how do you specify "abnormal" column names containing
spaces, etc. etc. etc.)
Does anyone has similar experience ?

Does anyone know know to import that XML file into a table in DB2 ?
If you move to DB2 9 (or above), you'll find the XML support introduced
in that version includes the ability to import from any XML structure
into multiple target tables (although I think there's some restrictions
on recursive structures) - provided you can describe the structure in
an XML schema [1], and/or with XPath expressions [2]. Alternatively,
you could just dump the whole XML file into an XML column - although
personally I only consider those useful for storing mixed-type docs
(i.e. HTML and other stuff that doesn't "shred" well). Still, you won't
find any options for importing "tabular" XML files directly via IMPORT
or LOAD (as mentioned above, given the plethora of styles one could use
you'd still have to describe the structure of the XML at which point
you may as well use the parsing support to shred the document into
tables).

However, if you want to stick with DB2 8, I'd suggest you forget about
using XML. Just export the data to a CSV file and use that. If you're
wondering how you can handle textual data containing line breaks with
CSV, have a look at the "delprioritycha r" modifier for LOAD [3] (or
IMPORT) which will allow you to include line breaks within quoted
values.

Another option, if you're feeling /really/ bored is to get your
application to write out IXFs directly - the structure is described
reasonably well [4] in the InfoCenter :-)
[1]
http://publib.boulder.ibm.com/infoce.../com.ibm.db2.l
uw.xml.doc/doc/c0022319.html

[2]
http://publib.boulder.ibm.com/infoce.../com.ibm.db2.l
uw.sql.ref.doc/doc/r0002169.html (see Example 5 at the bottom)

[3]
http://publib.boulder.ibm.com/infoce.../com.ibm.db2.l
uw.admin.cmd.do c/doc/r0008305.html#r 0008305__d1e253 1 (find
delprioritychar in the "modifiers for DEL" table)

[4]
http://publib.boulder.ibm.com/infoce.../com.ibm.db2.l
uw.admin.dm.doc/doc/r0004667.html
Cheers,

Dave.
Jun 27 '08 #4
Hi all,

Thanks for your invaluable inputs.

I finally find a solution : using SAS programming language.

Inside SAS, I can declare the XML file as a XML library.

This XML library is expecting the XML structure which is
exactly the same as my file's m x n cells table-like structure.

Therefore, SAS can automatically convert the XML table-like structure
into a SAS table.

Then, I can even do some transformation or data clean up
before inserting into DB2.

I am now focusing on inserting rows into DB2 thru SAS.
There is some SAS-DB2 setup problem in my AIX.

Anyways, I will fix it.

Once again, thanks everybody for your help.
Bye.
Alvin SIU
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3481
by: Eric Caron | last post by:
Hi I try to import file in a dataset. How I can do this ?
5
3142
by: MF | last post by:
Newby question but can't find it myself. How can I get a file-description from a file / table ? eg. the decription must deliver the following info: Record nr. Field nr. Fieldname Field description
0
1211
by: yuppiest | last post by:
Dear All, I'm trying to import a quite large text file (25mb) I had this working fine by using the transfertext command and having a schema.ini file, however having changed the username and password for my connection to SQL server all my tables and queries come with dbo attatched, which is fine as I've now edited all the relevent code and macros. However, on the transfer text command, it doesn't recognise the table I want to import...
2
2136
by: Mike C# | last post by:
Hi all, Can someone point me in the direction of a how-to for reading the Import Address Table for an .exe or .dll file? I'm trying to programmatically determine DLL dependencies (like Depends.exe, but in my own application). Also, is there a way to determine LoadLibrary dependencies programmatically without loading and running the application? A pointer to an article or other resource would be much appreciated. Thanks
11
2454
by: kaisersose1995 | last post by:
Hi, I've got an import procedure working, using a standard import specification to import a .csv file into a temporary table. The problem i'm having is that i have 4 different sets of borrower details on the same line e.g. B1-Title, B1-Initials, B1-Surname, B2-Title, B2-Initials, B2-Surname, etc. all linked to my main borrower table via an unique account number. My 1st append query matches which account numbers are new to the main...
0
1328
by: oiref | last post by:
Why wont access 2003 generate an import errors table to show rejected data.It shows the normal dialog box and then tells me about the data it wont append to the table but thatis it! thanx anyone
2
4196
by: adil6535 | last post by:
hi, I have one question about database 10g how i can export or import one table from one user to other user please help me thanks
1
2296
by: duynv | last post by:
hello everybody! i want to import a table .dbf(visual foxpro) into microsoft access but i can't. Please help me about this problem. Thanks
2
1954
by: annamalainagarajan | last post by:
hi genius, i am using a ms-access database as a back-end and front-end as a vb6. now i want use as a ms-access as multiuser database, so i create the client database as linked tables of server database. if i create a new table on master database, how can i import linked table to client database at the application runtime using the vb6 coding. pls, is there any idea pls..............
1
2639
by: bbatson | last post by:
Hello, Does anyone know how to prevent the creation of an import errors table when importing data from an external source such as Microsoft Excel? Thanks!
0
9669
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9517
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10428
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10156
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9997
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.