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.
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
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.