public static String[] getSchemas(Connection connection) throws Exception { if (connection != null) { List<String> schemaList = new ArrayList<String>(); DatabaseMetaData mObject = connection.getMetaData(); ResultSet schemas = mObject.getSchemas(); while (schemas.next()) { schemaList.add(schemas.getString(DBConstants.DataServiceGenerator.TABLE_SCHEM)); } String str[] = schemaList.toArray(new String[schemaList.size()]); return str; } else { return null; } }