DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    635

    retrieving a list of databases

    I've search everywhere, and nothing seems to answer the question. I don't need a list of tables on a database, but a list of databases on the sql server. At which point I can then choose one to connect to then list its tables.
    Last edited by Phaelax; 11-23-2005 at 08:34 PM. Reason: solved

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    255
    You could check the JDBC API for DatabaseMetaData. There is a method called getCatalogs().
    Happiness is good health and a bad memory.

  3. #3
    Join Date
    Mar 2004
    Posts
    635
    thx, got it.

    For anyone else who's wanted to know:
    Code:
    DatabaseMetaData dbmd = connection.getMetaData();
    ResultSet result = dbmd.getCatalogs();
    while(result.next())
    {
         String tableName = result.getString(1);
         System.out.println(tableName);
    }

Similar Threads

  1. Replies: 0
    Last Post: 11-14-2001, 12:00 PM
  2. ListBot Going Out of Business
    By Larry Rebich in forum vb.announcements
    Replies: 1
    Last Post: 06-28-2001, 01:22 PM
  3. SQL list all databases
    By Rich in forum Database
    Replies: 2
    Last Post: 05-22-2001, 09:20 AM
  4. Replies: 2
    Last Post: 06-14-2000, 03:17 PM
  5. Replies: 0
    Last Post: 06-14-2000, 11:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links