By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,225 Members | 1,051 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,225 IT Pros & Developers. It's quick & easy.

What is the connected database?

P: n/a
Hi!

How can I determine the name of a database I'm connected to.
I tried the SNAP_GET_DB, SNAPSHOT_DATABASE, ... but all these return all
databases that are defined as "Indirect" or "Home" in LIST DATABASE
DIRECTORY command. This is not the desired behaviour.

Any ideas?

Best regards,
Kovi

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
| Gregor Kovac | Gr**********@mikropis.si |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Mar 15 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Gregor KovaÄŤ wrote:
Hi!

How can I determine the name of a database I'm connected to.
I tried the SNAP_GET_DB, SNAPSHOT_DATABASE, ... but all these return all
databases that are defined as "Indirect" or "Home" in LIST DATABASE
DIRECTORY command. This is not the desired behaviour.


Query the CURRENT SERVER special register:

$ db2 values current server

1
------------------
TEST

1 record(s) selected.

(All my databases are named "TEST" ;-))

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Mar 15 '06 #2

P: n/a
Knut Stolze wrote:
Gregor Kovač wrote:
Hi!

How can I determine the name of a database I'm connected to.
I tried the SNAP_GET_DB, SNAPSHOT_DATABASE, ... but all these return all
databases that are defined as "Indirect" or "Home" in LIST DATABASE
DIRECTORY command. This is not the desired behaviour.


Query the CURRENT SERVER special register:

$ db2 values current server

1
------------------
TEST

1 record(s) selected.

(All my databases are named "TEST" ;-))

Yes!! Thanks...

What other special registers are there ? :)
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
| Gregor Kovac | Gr**********@mikropis.si |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Mar 15 '06 #3

P: n/a
Gregor KovaÄŤ wrote:
What other special registers are there ? :)


Quite a few: http://tinyurl.com/porln

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Mar 15 '06 #4

P: n/a
Try this

db2 get connection state
cheers.....
Shashi Mannepalli

Mar 15 '06 #5

P: n/a
Shashi Mannepalli wrote:
Try this

db2 get connection state
cheers.....
Shashi Mannepalli


Hi!

VALUES(CURRENT_SERVER) is a better wys, since I can run this as SQL
statement.

Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
| Gregor Kovac | Gr**********@mikropis.si |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Mar 27 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.