getSchemas()
metoda DatabaseMetaData je zřejmá, ale s MySQL musíte použít 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()
Příklad:
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") );
}