Solved

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

Posted on 2004-08-18
6
162 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

943 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now