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

Posted on 2004-08-18
Medium Priority
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.
Question by:kevinbenedict
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
  • 3
  • 2
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.
LVL 29

Expert Comment

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.


Author Comment

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)

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 29

Expert Comment

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;


Author Comment

ID: 11884394

   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?

LVL 29

Accepted Solution

leonstryker earned 1600 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.


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

743 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