0

I have written a program in java that reads .csv files and stores them into a database table. But the performance of the storing operation is very slow. When I use DB2 Command Line Processor there is a drastic change in performance and it's very fast. So, I am trying to customize DB2 Command Line Processor according to my requirement. I searched on Google but I only found topics for how to use it. I would like to get clear on following subjects before I start.

  1. Is "DB2 Command Line Processor" open source?
  2. Which programming language is used?
  3. Is there alternative like DB2 Command Line Processor with open source-code in java?
  4. Is there a way to call DB2 Command Line Processor out of a java program?
3
  • You may want to clarify the question: The Command Line Processor by itself does not have the ability to read data from a file. Do you mean that you are using DB2's IMPORT or LOAD utility and comparing that with your own application's performance? Commented Jan 21, 2013 at 22:01
  • Yes,i am using DB2 Command Line Processor for loading Csv and inserting and it does not have any relationship with my application.But,my application some time need to read csv data and insert it.So,the performance related to my application. Commented Jan 22, 2013 at 2:59
  • Please provide the exact command you are using. If you are using the LOAD command, you almost certainly won't be able to match its performance. But if you are using the IMPORT command, @Bruce Martin's suggestion below may help. Commented Jan 22, 2013 at 18:11

2 Answers 2

1

It may be worth investigating the Java program, the slow run times may be related to how often you are commiting the data (i.e. you may running in auto-commit mode (commiting after every insert)).

Committing after every 500 insert may be a lot faster than commiting after every record

see DB2 autocommit for details on auto-commit

0

1) DB2 CLP (command line processor) is part of DB2. It is not open source, and it is included in all editions (Express-C, express, workgroup, extended), and in the Data Server client. This last is free to download, and install in all clients.

2) The best way to use the capabilities os DB2CLP is via scripts, such as bash scripts or windows scripts. You can also call the db2clp from another program, such as a java application (runtime).

3) There are shells for databases with open source licence, however, you are mixing two things: a shell, that is normally a black screen where you type commands. And a driver to query a database from a program developed by yourself.

4) Again, via Runtime, http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html

Finally, the best is to use a JDBC driver, in order to do things directly, and not with a lot of tiers. You have to check your Java code, probably the reading is not efficient. And also, check the properties of the DB2 Java driver.

One more thing, if you want the fatest, try to use LOAD to insert data in the database. It does not perform any log. You can call LOAD from a java application (remember to load the db2 environment before executing any command)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.