473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting a list of databases

Hello,

I need a way to list an instance's databases, in a way which is easy to
parse (I can't count on perl or similar scripting tools to be available
everywhere). I know of the 'db2 list database directory' command, but its
output doesn't qualify for "easy to parse" for me, when I simply need a
list of "local" databases (i.e. Directory entry type = Indirect).

I've tried browsing around the SYSCAT views, but with no luck.

What I'd like to find is a query such as:

SELECT databasename
FROM something
WHERE direntry_type='Indirect'

Any ideas?

--
Troels Arvin
Jan 9 '07 #1
2 27354
$ db2 list database directory show detail | grep -B6 -i indirect |
grep "Database name"

Thanks
swami.

--------------------------------------------------------------------------------------------------------------------------
Troels Arvin wrote:
Hello,

I need a way to list an instance's databases, in a way which is easy to
parse (I can't count on perl or similar scripting tools to be available
everywhere). I know of the 'db2 list database directory' command, but its
output doesn't qualify for "easy to parse" for me, when I simply need a
list of "local" databases (i.e. Directory entry type = Indirect).

I've tried browsing around the SYSCAT views, but with no luck.

What I'd like to find is a query such as:

SELECT databasename
FROM something
WHERE direntry_type='Indirect'

Any ideas?

--
Troels Arvin
Jan 9 '07 #2
If you just want the database names, without the titles, use:

db2 list database directory show detail | grep -B6 -i indirect | grep
"Database name" | sed "s/.*= //"
The space after the equal sign (=) in the sed command is needed to
delete the space after the equal sign in the output of the list command.

Phil Sherman

swami wrote:
$ db2 list database directory show detail | grep -B6 -i indirect |
grep "Database name"

Thanks
swami.

--------------------------------------------------------------------------------------------------------------------------
Troels Arvin wrote:
>Hello,

I need a way to list an instance's databases, in a way which is easy to
parse (I can't count on perl or similar scripting tools to be available
everywhere). I know of the 'db2 list database directory' command, but its
output doesn't qualify for "easy to parse" for me, when I simply need a
list of "local" databases (i.e. Directory entry type = Indirect).

I've tried browsing around the SYSCAT views, but with no luck.

What I'd like to find is a query such as:

SELECT databasename
FROM something
WHERE direntry_type='Indirect'

Any ideas?

--
Troels Arvin
Jan 9 '07 #3

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

Similar topics

5
by: Travis McCarter | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I am trying to write a PHP script that will download a list of all the newsgroups on a news server and put them into a MySQL database. I bought a...
8
by: Opa | last post by:
Hi, Does anyone know how to get a list of files for a given directory from a given url. I have the following, but get an error indicating that URI formats are not supported. ...
2
by: Dawid Mostert | last post by:
Hi, I'm trying to get a list of properties from a hierarchy of classes, using reflection. Using Type.GetProperties(), I get the list back in "reverse hierarchy order" (derived class...
2
by: gbgbgbgb | last post by:
Hi, I have a definition bool operator<(string s_s, string s_t) { .... } and a variable list<string> concomp;
3
by: BobTheDatabaseBoy | last post by:
.... got: win2K, v8.1.6 login to win2K is to the network: user; bob13, domain; foo it's a win2K domain. i then login to my local db as db2admin. LIST APPLICATIONS fails with security error. ...
2
by: Susan | last post by:
I'm trying to get the list of all of the controls on a form which works great except for getting the name of the HelpProvider. For instance: for (int i = 0; i < this.Controls.Count; i++) { temp =...
0
by: Dan Nordquist | last post by:
Hey everyone. I'm just getting my feet wet with ADSI (and VB.NET, and ASP.NET, really), but I'm wondering if there's a way to pull a list of distribution lists from an Exchange server using...
41
by: pb648174 | last post by:
In a multi-user environment, I would like to get a list of Ids generated, similar to: declare @LastId int select @LastId = Max(Id) From TableMania INSERT INTO TableMania (ColumnA, ColumnB)...
6
by: doofy | last post by:
Anyone know how I can pull in a list of available database servers on my computer (which I will then use to populate a combo box)? Even just the namespace to use would be a start, though more...
1
LegalIT
by: LegalIT | last post by:
Hello, I am using VB.net. I would like to allow the user to pick a database to use on an SQL server. Is there a way to get a list of available database on a server? Thanks! LegalIT
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.