467,189 Members | 1,394 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,189 developers. It's quick & easy.

What is the connected database?

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
  • viewed: 1374
Share:
5 Replies
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
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
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
Try this

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

Mar 15 '06 #5
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.

Similar topics

5 posts views Thread by lkrubner@geocities.com | last post: by
1 post views Thread by Franz-Josef | last post: by
3 posts views Thread by E. W via DotNetMonster.com | last post: by
1 post views Thread by dejavue82@yahoo.com | last post: by
3 posts views Thread by mminnie@minniebyte.com | last post: by
11 posts views Thread by James R. Davis | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.