Hi Joachim,
On 08.03.12 9:11 ,
jtu...@objektfabrik.de wrote:
> so both have the same effect, but only the environment variable option is
> available when using the Driver packages.
Yes, this is correct, because you don't have a DB2 environment with the driver
package.
> To me that means I prefer using the environment variable. And still this
> leaves me with some bitter taste: if I set the value using db2set, what is
> the scode of that setting? The db user? All connections that are
> established on this machine?
What do you mean by scode? I don't understand the question. But I think you
are still confusing registry variables which apply to the instance and
registry variables which apply to the client.
I'll try to explain it again. Databases are usually used in 3-tier
environments. The database server on one machine and the database client on a
different one. Even in a 2-tier environment, DB2 works as a client-server
application (in that case the client is automatically installed under the
instance user as well).
You have to install a database client to connect to the server (these days you
can also use the driver package which consists of basically a few files and
does not come with a DB2 environment which is provided by the client).
So, on the client you can set registry vaiables which apply to the client -
not to the server.
If you set the db2codepage registry variable or environment vaiable on the
server, it would only affect the client environment on the server.
Maybe it is easier to understand it this way:
You have to have an OS user to set up the database client (if you use a 2-tier
environment, it will be most likely the same user as the instance user).
If you set DB2CODEPAGE (either via db2set or export), you have to do this with
an OS user. All connections done with this OS user will inherit this setting.
A client connection with a different user and/or client will not be affected.
> I remember reading the text you cite several times but I must admit I never
> understood it and still don't. I never really understood the difference
> between db2 registry variables and environment variables. The fact that
> db2codepage is referred to as db2 registry variable to me somehow meant
> this is a db2 internal thing and therefor has to be maintained using db2set
> or the like. This put so much smoke around me that I even didn't dare
> trying the obvious ;-)
As with a lot of things in DB2, they evolved during time. So the reason for
environment and registry variables are as follows:
In the beginning of time (DB2 time that is :-)), we had to reboot machines for
environment variables to take effect. There was also the fact that you could
(and still can) attach to an instance and administer the instance remotely.
Most people ssh to the server and work with the instance directly though.
Anyway, registry variables can be changed from a client when attached to the
instance. Environment variables can not be.
We created the registry variables to have environment variables which are
under DB2 control and which can be changed via DB2 commands.
Theoretically you could use environment variables instead, although I rather
advise against it - you can get confused quite easily, especially about the
order they are resolved.
There are certain exceptions (e.g. DB2INSTANCE, DB2NODE, ...) which have to be
set as environment variables.
> So, even though my problem is solved, I still have some open questions...
I tried to answer them. I hope my explanations were sufficient...