getSchemas()
metode DatabaseMetaData sudah jelas tetapi dengan MySQL Anda harus menggunakan getCatalogs()
http://download .oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getSchemas() http://download .oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getCatalogs()
Contoh:
Class.forName("com.mysql.jdbc.Driver");
// change user and password as you need it
Connection con = DriverManager.getConnection (connectionURL, "user", "password");
ResultSet rs = con.getMetaData().getCatalogs();
while (rs.next()) {
System.out.println("TABLE_CAT = " + rs.getString("TABLE_CAT") );
}