>Here is an example: Prior to fixpack 7 you could not update the
database configuration parameter STMTHEAP while online to the database.
I added code to do this now. If I hard coded to version 8.1 instead
of 8.2 my call the db2CfgSet fails.
No. The call fails if you're connected to an 8.1 DB2 server that doesn't
allow such an update. When you are connected to a 8.2 server using
db2Version81 , the call will succeed. The db2Version for the APIs and the
actual version/release of the database server are two different things.
Then DB2 has a problem. I am running db2Version822. I call to bump
the STMTHEAP parameter if I received a certain SQLCODE. In my test
function I set the db2 version to db2Versoin810 because it was in the
example in the DB2 Info Center description of the function and I did
not change it to the true version because I am still trying to
determine how to easily get the current version (and is the reason for
this post).
The call failed and I could not update the setting. I opened a pmr
with DB2 thinking it was broken (I forgot I had the db2Version set
wrong in the call). After a couple of discussions with DB2 support we
found the problem. I changed the version to db2Version822, which is
the correct version that contained the change, and it works. If you
are telling me it should have worked no matter which version I passed
in then db2 has a bug. However, I dont see the purpose of requiring
the caller to pass in the db2Version if DB2 does not intend to use it.
What about intercepting the error messages? After all, you do need error
handling anyways...
I have plenty of error handling. If fact, this very function is all
about error handling. If I get an SQL error from any command this
function does various things to deal with it. Why provoke an error
when I can avoid it? If I know the call wont work because I am on the
wrong db2 version then why make the call? I am error handling so I
should be smart enough to know I cannot perform that action. If I do
not verify the version I am using then I am suddenly the cause of the
error.
'Taking the customer down'...There is much more to this then I have
time to really explain. Whenever you do something you are not suppose
to you could potentially hit a problem that brings down the
machine....this is the worse case of course. But, even in the simplest
case you can create problems unnecessarily. For instance, many of the
database and Database Manager configures will not take affect unless
you start and stop the database instance. To do this all processes are
forced off the database. This sounds simple but how do those processes
recover? Do they spin and wait for you to allow them to reconnect? Do
they error on that database operation and keep trying the next
operation in thier queue? When will the database become available?
At any rate, if the processes cannot connect to the database to do work
your customer is down. Let me say, changing the STMTHEAP would not be
an example where I would do a force stop but some of the settings, like
out of memory, would be. If I know there is a way to cure the problem
without doing this then I want to attempt it.
The point of this post is not how I can avoid giving the API calls the
true version but how can I get the correct version so I can determine
the best course of recovery. I realize there may not be many using the
new API calls because they are running existing code with the old APIs
that have already been established. This is new developement and we
are trying to utilize the new API calls...though some days I have to
resist the urge to just go back to the old!
Last, I am not a DB2 expert. In fact, DB2 is very new to me so if I am
missing some point I appreciate the patience and explanation. I am not
really sure what the purpose is for the addition of the version in
these calls other then in case someone wants to use older functionality
even if they are running new code. I would think anything new would be
an improvement to the old but what do I know!?