dbTalk Databases Forums  

function that returns name of underlaying database?

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss function that returns name of underlaying database? in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lennart Jonsson
 
Posts: n/a

Default function that returns name of underlaying database? - 02-07-2011 , 07:16 AM






LUW 9.5, this may sound as a silly request, but has to do with refresh
of directory cache and workspaces in RAD. Is there a function that
returns the name of database that I'm connected to? Example:

Server
catalog db X as E

Client
catalog tcpip node A remote B server C remote_instance D
catalog db E at node A as F

connect to E user ... using ...
values <current_db_function()>

should return X

In the manner it would be nice to get the hostname of the server where X
resides.


/Lennart

Reply With Quote
  #2  
Old   
Udo
 
Posts: n/a

Default Re: function that returns name of underlaying database? - 02-07-2011 , 07:26 AM






On Feb 7, 2:16*pm, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com>
wrote:
Quote:
LUW 9.5, this may sound as a silly request, but has to do with refresh
of directory cache and workspaces in RAD. Is there a function that
returns the name of database that I'm connected to? Example:

Server
catalog db X as E

Client
catalog tcpip node A remote B server C remote_instance D
catalog db E at node A as F

connect to E user ... using ...
values <current_db_function()

should return X

In the manner it would be nice to get the hostname of the server where X
resides.

/Lennart

db2 "values current server"

should do the trick

Udo

--
Speedgain for DB2 - The DB2 Monitor
http://www.itgain.de/en/produkte/speedgain.html

Reply With Quote
  #3  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: function that returns name of underlaying database? - 02-07-2011 , 07:50 AM



On 2011-02-07 14:26, Udo wrote:
[...]
Quote:
db2 "values current server"

should do the trick

Thanks Udo, Tried a number of scenarios, and it appears to be working
just fine.


/Lennart

[...]

Reply With Quote
  #4  
Old   
Bruce
 
Posts: n/a

Default Re: function that returns name of underlaying database? - 02-07-2011 , 08:11 AM



On Feb 7, 8:16*am, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com>
wrote:
Quote:
LUW 9.5, this may sound as a silly request, but has to do with refresh
of directory cache and workspaces in RAD. Is there a function that
returns the name of database that I'm connected to? Example:

Server
catalog db X as E

Client
catalog tcpip node A remote B server C remote_instance D
catalog db E at node A as F

connect to E user ... using ...
values <current_db_function()

should return X

In the manner it would be nice to get the hostname of the server where X
resides.

/Lennart
Or this, no?

db2 get connection state

Database Connection State

Connection state = Connectable and Connected
Connection mode = SHARE
Local database alias = MYDB
Database name = MYDB
Hostname =
Service name =

Reply With Quote
  #5  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: function that returns name of underlaying database? - 02-07-2011 , 08:29 AM



On 2011-02-07 15:11, Bruce wrote:
[...]
Quote:
db2 get connection state

Database Connection State

Connection state = Connectable and Connected
Connection mode = SHARE
Local database alias = MYDB
Database name = MYDB
Hostname =
Service name =
If MYDB is a cataloged db on the server (i.e. not a real db), it will
still report MYDB as the database name. Udo's suggestion reports the
real db.


/Lennart

Reply With Quote
  #6  
Old   
Udo
 
Posts: n/a

Default Re: function that returns name of underlaying database? - 02-07-2011 , 08:30 AM



Quote:
Or this, no?

db2 get connection state

* *Database Connection State

*Connection state * * * = Connectable and Connected
*Connection mode * * * *= SHARE
*Local database alias * = MYDB
*Database name * * * * *= MYDB
*Hostname * * * * * * * =
*Service name * * * * * =
db2 catalog db sample as xxx
db2 connect to xxx
db2 get connection state

Database Connection Information

Database server = DB2/NT64 9.7.1
SQL authorization ID = UDO
Local database alias = XXX

That's not what the OP wanted. He wanted "sample" in this case.

Udo

--
Speedgain for DB2 - The DB2 Monitor
http://www.itgain.de/en/produkte/speedgain.html

Reply With Quote
  #7  
Old   
sanjay kumar
 
Posts: n/a

Default Re: function that returns name of underlaying database? - 02-10-2011 , 06:58 AM



Are you looking for some function in DB2?

Or anything in Java? Or what?

DB2: SNAP_GET_DB table function

Something more you might need:
SELECT * from SYSIBMADM.ENV_SYS_INFO


Submitted via EggHeadCafe
SharePoint Tip / Thought of the Day WebPart
http://www.eggheadcafe.com/tutorials...y-webpart.aspx

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.