how do i get the hostname in sql?

i've created a view on a db2 v9.1 on AIX
i need to extract the hostname in a variable, and use that variable in a query instead of hardcoding the hostname
how do i get the hostname (actual machine name) in sql?
select col1, 'MY_HARDCODED_HOST_NAME' as hostName, col2, etc

Open in new window

LVL 2
iamariAsked:
Who is Participating?
 
momi_sabagConnect With a Mentor Commented:
you can get it from a view called ENV_SYS_INFO  :
select HOST_NAME    
from SYSIBMADM.ENV_SYS_INFO
0
 
rfportillaCommented:
0
 
tliottaCommented:
The netnerds article is perhaps only partially correct. Apparently, what it's a solution for is the 'database name' rather than the hostname. Although those names are often the same, they're also often different. (The SQL0114 at the end of the article seems to reach the goal.)

So, please clarify _exactly_ what name is being sought.

A hostname would be useful for DNS resolution to an IP address. A database name would be useful for remote SQL requests.

Tom
0
 
iamariAuthor Commented:
thanks a lot, momi!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.