473,569 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_DATABA SE, ... 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**********@mi kropis.si |
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Mar 15 '06 #1
5 1543
Gregor KovaÄŤ wrote:
Hi!

How can I determine the name of a database I'm connected to.
I tried the SNAP_GET_DB, SNAPSHOT_DATABA SE, ... 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_DATABA SE, ... 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**********@mi kropis.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**********@mi kropis.si |
~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
Mar 27 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3030
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I write some PHP code which should, I think, be able to to auto create the tables. The SQL looks like this:
1
1415
by: Franz-Josef | last post by:
Hello all, I have a scripts which needs the information about the database in which it is running. How can I find out this information. For example if I want to know the User who has satrted this report, I use the SYSTEM_USER procedure.
3
1987
by: E. W via DotNetMonster.com | last post by:
Hi all, is it possible to get the numer of users, who are connected at the same time to the specified SQL Database and how do I get this Information? thanks EW -- Message posted via DotNetMonster.com http://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-csharp/200511/1
1
1940
by: dejavue82 | last post by:
Hello fellow programmers! My question concerns the scalability of database access. In coldfusion (or php for that matter) for example, there seems to be only the connected model for accessing a DB. On the other hand, there is asp.net 2.0, which provides disconnected and connected access. Question: Would databinding to controls directly,...
3
1460
by: mminnie | last post by:
After years of working with legacy systems, I am not starting to discover the .NET world. Wow. I am trying to figure out how Visual Basic, Windows Forms, Smart Clients, and all of the other .NET technologies work together. Here is what I want: I want a powerful desktop application with a rich user interface to read and write data on a...
5
12245
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected to the database. SQLSTATE=57030. Background: I created a linked server to DB2 8.1 database which called GRR_DB2Server. In my stored procedure...
0
1279
by: Hetal | last post by:
Hi.. I have a VB.NET (Windows forms) application and i would like to determine the type of database (SQL/MySQL/Access) i am connected to. In native VB6, say i have a connection object named cntDB, doing "cntDB.Properties(x)" will provide me with the type of database i am connected to. Here is a sample code from native vb6 application that...
4
7905
by: Vivek | last post by:
Hi, Generally we work with the 2 part qualified table names in db2 i.e. <schema>. <table name> Is there a more fully qualified table name ? I've seen that a select from <database name>.<schema>.<tabnamealso works. This brings me to the next question. Is it possible to refer to a table in database 2 when connected to database 1 ? If so...
11
1554
by: James R. Davis | last post by:
Yes, a newbie here. Though I am making progress, slowly, I am also getting more and more confused. With ASP, when I wanted to do something as trivial as updating a visitor counter, I connected to a database, executed a SQL command to read the current value of a field into a recordset, updated the value by adding 1 and writing the field...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.