Just to make this more transparent:
- the database server instance gets the server names from the configuration parameters
DBSERVERNAME and DBSERVERALIASES.
- it then needs to find an entry for each of the given names in the sqlhosts file.
- each of the sqlhosts entries tells the server, which of the following to use for the given name:
- protocol,
- hostname (i.e. IP address, e.g. of the network card/interface or local loop back)
- port number (for TCP/IP at least)
- the database server then starts a "listener thread" for each of these given names,
using the specifications (protocol, hostname, port) determined from the sqlhosts file.
- only one process (a listener thread of a database server in our case) can listen on a given
port number on a given IP address.
This is the uniqueness requirement for the combination of hostname and port number
already pointed out by Art.
- in the given case (as I understand it), the request is to have two database server instances
(production and development) use the same server name.
- this requires two different sqlhosts files, one for each database server.
(Otherwise, the same server name would appear twice in a single sqlhosts file, and thus the
database servers using it would not know, which of the two identical names they should use.
Probably they would both just pick the first one that matches one of the names given in their
configuration file ...)
- the separation of the two sqlhosts files is done via the INFORMIXSQLHOSTS environment
variable, that tells each database server, which of the two sqlhosts file to use.
- as only one listener process can listen on a given port (on the same machine, i.e. IP address),
the two entries with the same name (but in the different sqlhosts files) must specify a different
port number.
- database clients (production clients vs. development clients) likewise need to know, to which
hostname and port number they should connect. Usually, they use a sqlhosts file as well, and
specifying the environment variable INFORMIXSERVER tells a client, which sqlhosts entry to
use.
- as the names of the two database servers are the same, a client would equally be "confused"
when finding two sqlhosts entries with the same server name. (And likely would just pick the
first one.)
- the clean solution is that also the clients use different sqlhosts files. Like for the servers,
these sqlhosts files contain an entry with the same name (and protocol and hostname), but
with the different port numbers.
- with that, each database client can use that same name to find the correct (and individual) port
number, to which it needs to connect.
- it now becomes clear, that if the two database servers would reside on different machines,
their different sqlhosts files would contain different hostnames. With that, they could use the
same port number. But still, because of the same server name, they need to use different
sqlhosts files (i.e. cannot use the same sqlhosts file via a shared/mounted file system).
- also, the database clients would need different sqlhosts files as well ... each containing the
individual hostname for the entry with the same database server name.
A bit of background included, but I hope can help (rather than confuse more).
Regards, Martin
--
Martin Fuerderer
Software Engineer, Software Development
HCL Technologies Ltd.
Frankfurter Ring 17
80807 Munich, Germany
www.hcltechsw.com
::DISCLAIMER::
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects.