Java JDBC Database Metadata getCatalogs(Connection c)

Here you can find the source of getCatalogs(Connection c)

Description

get Catalogs

License

Apache License

Declaration

public static List getCatalogs(Connection c) throws SQLException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.sql.Connection;
import java.sql.DatabaseMetaData;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.util.LinkedList;
import java.util.List;

public class Main {
    public static List getCatalogs(Connection c) throws SQLException {
        DatabaseMetaData dmd = c.getMetaData();
        ResultSet rs = null;//  w w  w .  j a v a  2 s.  c o m
        try {
            rs = dmd.getCatalogs();
            List l = new LinkedList();
            while (rs.next()) {
                l.add(rs.getString(1));
            }
            return l;
        } finally {
            if (rs != null)
                rs.close();
        }
    }
}

Related

  1. adjustIdentifierCase(String identifier, Connection conn)
  2. createHsqlPlSchemaIfNecessary(Connection con)
  3. getAllTables(Connection connection)
  4. getAllTables(Connection connection)
  5. getColumnDefaultValue(DatabaseMetaData metaData, String tableName, String columnName)
  6. getColumnNames(Connection connection, String tableName)
  7. getColumnNames(String tablename, String column, Connection conn)
  8. getColumns(Connection connection, String name)