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 > How to run REORG from JDBC

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-22-09, 10:11
markm002 markm002 is offline
Registered User
 
Join Date: May 2009
Posts: 2
How to run REORG from JDBC

Our DB/2 application does some migration steps when a new version of the code is installed. One of these steps requires dropping a column from a table (which in DB/2 9 can be done with an ALTER TABLE DROP COLUMN statement).

But the resulting table is unusable until "REORG TABLE x" is executed. I can do this from the DB/2 command line, but it fails when run from from JDBC:

com.ibm.db2.jcc.c.SqlException: An unexpected token "TABLE" was found following "REORG ". Expected tokens may include: "JOIN <joined_table>".

This implies to me that this form of REORG cannot be done from JDBC... which really kills our auto-migration concept. Is there any way to do this strictly from JDBC? We cannot have manual admin steps in our application startup and migration sequence...

Thanks for any ideas!
Reply With Quote
  #2 (permalink)  
Old 05-22-09, 10:20
markm002 markm002 is offline
Registered User
 
Join Date: May 2009
Posts: 2
PS. DB/2 version details:

DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL09010" with
level identifier "02010107".
Informational tokens are "DB2 v9.1.0.356", "s060629", "NT32", and Fix Pack "0".
Reply With Quote
  #3 (permalink)  
Old 05-22-09, 10:21
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Call Sysproc.admin_cmd ('reorg Table Xxxxxxxxxx');

BTW, it is DB2, not DB/2.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #4 (permalink)  
Old 05-22-09, 10:22
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Use the ADMIN_CMD stored procedure:

DB2 Database for Linux, UNIX, and Windows

Andy
Reply With Quote
  #5 (permalink)  
Old 05-22-09, 10:24
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by markm002
PS. DB/2 version details:

DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL09010" with
level identifier "02010107".
Informational tokens are "DB2 v9.1.0.356", "s060629", "NT32", and Fix Pack "0".
That is very old code. You should apply the latest fixpack, which I believe is FP7. If you are using DB2 Express-C then you cannot apply fixpacks to that version.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
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