Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

enumerate databases on a server Oracle, SQL Server, etc.

Posted on 2004-08-18
6
177 Views
Last Modified: 2013-12-25
I would like to know how to enumerate all databases on a given server, whether it be Oracle, SQL Server, Sybase, MySQL, etc.

I'm familiar with SQLDMO for SQL Server.
0
Comment
Question by:kevinbenedict
  • 3
  • 2
6 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 11839030
Well, for SQL Server you can use the following query:

     SELECT * FROM master..sysdatabases


I don't think there is a generic way that works across all database servers.
0
 
LVL 29

Expert Comment

by:leonstryker
ID: 11841425
Ther is no generic way to do this.  Each database server has a different way of keeping track of their own databases.  You would have to setup different functions base on the type of database server used.

Leon
0
 

Author Comment

by:kevinbenedict
ID: 11842475
  "Each database server has a different way of keeping track..."

Does anyone know what those ways are, say of 3 of the common RDBMSes out there? (Oracle, Sybase, MySQL)

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 29

Expert Comment

by:leonstryker
ID: 11842633

MySQL: show databases;
Sybase and MS-SQL: SELECT name FROM master..sysdatabases

MS SQL Server database is equivalent to an Oracle tablespace. A tablespace is a logical method of storage. A tablespace consists of one or more physical files. A tablespace can have 0 or more schemas (eg a rollback or temp tablesspace doesn't really have a schema).

Oracle: SELECT tablespace_name FROM dba_tablespaces;

Leon
0
 

Author Comment

by:kevinbenedict
ID: 11884394
Leon,

   you said: "MySQL: show databases;"

Is "show databases" a command I can execute on an ADO Connection and return a recordset?  How would that work to list the databases in code?

Thanks
0
 
LVL 29

Accepted Solution

by:
leonstryker earned 400 total points
ID: 11884440
>>Is "show databases" a command I can execute on an ADO Connection and return a recordset?  

As far as I understand it, Yes.  I have not worked with MySQL myself, but got this from a reliable source.  Of course you should test it.  You can also post this question in the MySQL area and I am sure they will confirm this or suggest a better method.

Leon
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question