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 > Compiling C Program

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-05, 15:06
mgupta mgupta is offline
Registered User
 
Join Date: Oct 2003
Posts: 80
Compiling C Program

We are on UDB ESE 8.1 FP6a on AIX 5.2L.
When I compile a C program and bind it first time, it works fine.

However if I recompile the program and then bind it again, I get timestamp -818 error on executing it. It seems DB2 does not pick up the updated library. Even if binary in sqllib/function is updated, DB2 does kepp using the old one previously loaded.


I found out that if I stop db2 and restart db2, then db2 picks up the recompiled version and everything is fine..

Is there anyway to refresh the cache without recycling DB2 ?

thanks
Reply With Quote
  #2 (permalink)  
Old 03-10-05, 16:12
fohana fohana is offline
Registered User
 
Join Date: Jan 2005
Location: Rio de Janeiro - Brazil
Posts: 28
This problem occours because you have 2 applications using packages with the same name.

You should consider versioning the packages generated by the PRECOMPILE (PREP) statement.

I´d recommend you use the parameter PACKAGE, like this:

db2 PREP <application> BINDFILE PACKAGE USING <versioned_pkg_name>

You can also choose to rename the BINDFILE name generated by the precompile command. Although I´m not sure if this will solve this problem.

One question to more experienced users:

If I issue this precompile statement:

PREP <application> BINDFILE xpto.bnd

The bindfile name will be "xpto.bnd", instead of the "<application>.bnd", right?

If so.. does it change, also, the package name (in an implicit manner)?
Reply With Quote
  #3 (permalink)  
Old 03-10-05, 17:07
mgupta mgupta is offline
Registered User
 
Join Date: Oct 2003
Posts: 80
fohana,
thanks for the response but that is not the problem in my case..

I found that solution is if this is a stored procedure , then you need to ensure KEEPFENCED is set to NO.. This is a dbm cfg parameter. KEEPFENCED is a parameter that will 'cache' stored procedure code, so that if you call a stored procedure, it will not create a brand new db2fmp process everytime... The db2fmp process is the process spawned by the db2agent that actually executes the user code.

KEEPFENCED YES is default, and is highly recommended in production, for performance reasons. However in development, it is recommended to set KEEPFENCED to NO, so that DB2 does not cache the procedures, and so when you make a change, and execute the new code DB2 will pick that new code up.

Stopping/Starting the instance is the only way to 'refresh' the cache when KEEPFENCED is set to YES.
Reply With Quote
  #4 (permalink)  
Old 03-10-05, 17:26
fohana fohana is offline
Registered User
 
Join Date: Jan 2005
Location: Rio de Janeiro - Brazil
Posts: 28
I thought this parameter was related only to the fenced process. From what I got, if setting this parameter to YES, after completing the execution of a fenced routine, the fenced process will not be destroyed. Otherwise, the fenced process is destroyed.

I didn´t know if setting the dbm cfg to keep fenced process would cause the caching of the sp code.

Thank you too!
Reply With Quote
  #5 (permalink)  
Old 03-10-05, 19:48
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
You can issue the SQL statement FLUSH PACKAGE CACHE DYNAMIC.
__________________
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