If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > sqluimpr/sqluexpr but with Java

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-17-04, 16:00
young_matthewd young_matthewd is offline
Registered User
 
Join Date: Apr 2004
Posts: 10
sqluimpr/sqluexpr but with Java

importing/exporting APIs ought to be available via Java (JDBC)...

It seems odd with decent Java support for most database managers that DB2 does not provide similar sqluimpr/sqluexpr API utilities in any other language than C. More so given the popularity of JDBC.

I written an Ant XML based document that connects XML tags to Java JDBC functions to open a connection, import/export data, and close a connection. Currently, I parse only DEL ascii files with a CSV parser and perform either inserts or updates to simulate importing. It would be great if DB2 provides a simple API from JDBC connection/statement constructs for importing data from all three supported formats (del, ixf, and asc).

I realize that the XML Extender utilities are intended to handle import/export cases. However, creating DAD documents for every table in a database is not the most attractive solution to importing/exporting data. It is rather easy to pull data via rec2xml commands but an admin hassel to put back the data into a mirror table.

Any suggestions? - Matthew Young
Reply With Quote
  #2 (permalink)  
Old 05-17-04, 16:23
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Matthew,
Yes. FIrst let me explain why. IMPORT and EXPORT are NOT SQL. They are DB2 commands. That is why they cannot be executed with the JDBC standard. There is a way to perform any DB2 command through Java though.
Take a look at the sample code provided by IBM:
http://www.developer.ibm.com/tech/sampdb2.html
especially the runstats.zip one.

This is what you are basically doing.
1) open a DB2 command window
2) execute the java app in this window
3) the Java app spawns child processes that do the Db2 commands

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 05-18-04, 10:57
young_matthewd young_matthewd is offline
Registered User
 
Join Date: Apr 2004
Posts: 10
JDBC support for transforming XML

andy, i realize that import/export are DB2 utilities however IBM extended them via a C API and I still find it odd that an extension what not made for Java.

the solution to refer to is not usuable. the reason i mentioned JDBC in the first place is because remote drivers enable non-local calls. the runstats Java example simply kicks off Unix based db2 commands.

somebody has to have thought of integrating XML and JDBC before for import/export tasks. there is db2xml freeware however it doesn't not reuse pre-made JDBCConnection objects as inparameters to ResultSet parsing. major drawback.

/matthew
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On