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 > db2 utils

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-09-05, 01:13
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
db2 utils

is it possible to call db2 (ver 7.2 on windows) utilities such as LOAD from java code ? if yes, how ?
Reply With Quote
  #2 (permalink)  
Old 03-09-05, 01:41
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
For export and import you have C APIs ... You can call them using JNI .. Refer the manual Adminstrative APIs for more information on these APIS

From V8, LOAD also has an API ...


The other alternative is to invoke a command line from the Java code ...

Cheers
Sathyaram
Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 03-09-05, 02:05
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
invoking the command line from java sounds like an option. Is there any code I can use to show our developers.

thanks.
Anil
Reply With Quote
  #4 (permalink)  
Old 03-09-05, 02:36
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
This is used extensively
http://www.devdaily.com/java/edu/pj/...pj010016.shtml
gives a basic java example ..

Instead of ps -ef, you may use (this is a ksh example)
db2_export.ksh sample1 table1.ixf ixf "select * from table1"

where the db2_export.ksh script will be
#/bin/ksh
#
#
db2 connect to $1
db2 export to $2 of $3 $4 with ur
db2 terminate

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 03-09-05, 07:58
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Here is an example from IBM on how to use the command line from java:

http://www.developer.ibm.com/tech/sampdb2.html

Look at the runstats one in particular.

Andy
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