Results 1 to 5 of 5
  1. #1
    Join Date
    May 2009
    Posts
    2

    Unanswered: 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!

  2. #2
    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".

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Use the ADMIN_CMD stored procedure:

    DB2 Database for Linux, UNIX, and Windows

    Andy

  5. #5
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •