DB21034E when creating stored procedure in DB2

While I was trying to create a stored procedure in my DB2 Express-C windows installation, I got the following error message:

DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command.  During SQL processing it returned:SQL0219N The required Explain table "SCHEMA.EXPLAIN_INSTANCE" does not exist. LINE NUMBER=16.  SQLSTATE=42704

At first, this error message didn’t make much sense. Why would DB2 need to use the explain tables if I’m not running this command in the explain mode? Even doing a db2 set current explain mode no didn’t seem to help. But, creating the explain tables would solve the problem (you can create the explain tables by hand by runing db2 -tvf ~/SQLLIB/MISC/EXPLAIN.DDL). If creating the explain tables would solve the problem, it was because somehow, DB2 was running in the explain mode when creating the stored procedures.

Investigating the DB2 registry variables (db2set -all) I noticed the existence of the variable:

 [i] DB2_SQLROUTINE_PREPOPTS=explain yes

A search for this term on DB2 documentation and the answer was found. The variable DB2_SQLROUTINE_PREPOPTS is used to specify the precompile and binding options for store procedures. After knowing that was the problem, the fix is easy. Just update the registry variable running db2set DB2_SQLROUTINE_PREPOPTS="explain no".

Note: Since this is an instance level variable, the changes will only make effect after you restart your DB2 instance. Just run db2stop and db2start and you’re good to go!
 

VN:F [1.9.11_1134]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.11_1134]
Rating: 0 (from 0 votes)

Popularity: 7% [?]

Tags: . 

Related Entries:
  • Reset user account in AIX
  • DB2 on Rails update
  • How to get an access plan in DB2 using db2exfmt
  • community strikes back, part 2
  • Persisting XML with OpenJPA


  • 4 Responses to “DB21034E when creating stored procedure in DB2”

    1. corrupt registry Says:

      hey, your post

      VA:F [1.9.11_1134]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.11_1134]
      Rating: 0 (from 0 votes)
    2. sethvu Says:

      Мне все понравилось, только если бы еще денег на блоге дали или конкурс провели, было бы вообще отлично.

      VA:F [1.9.11_1134]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.11_1134]
      Rating: 0 (from 0 votes)
    3. CarGames Says:

      Gaming is what we have been doing since we were young. It has become a genuine part of our lives especially our childhood. And apparently, it what keeps us sane and intact as it relieves stress and become a prime leisure. Online car games are rampant variations of the games we have loved. As the years progress through the new millennium, more free online games are shown off in the World Wide Web. And as technology flourished through the years, the evidence of progressive online gaming developing catered a wider scope. More probabilities are entertained and more needs are catered. What happens now is that people are torn between what is proper to have and what is not proper to own but will be better to have.

      VA:F [1.9.11_1134]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.11_1134]
      Rating: 0 (from 0 votes)
    4. Tarsha Applebee Says:

      Whats up! I just wish to give a huge thumbs up for the good information you might have right here on this post. I will likely be coming back to your weblog for extra soon.

      VA:F [1.9.11_1134]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.11_1134]
      Rating: 0 (from 0 votes)