Skip to content

Commit

Permalink
Deal with JDBC drivers that inappropriately return null for getSchemas()
Browse files Browse the repository at this point in the history
  • Loading branch information
johncurrier committed Aug 19, 2010
1 parent e20f85b commit 6a403ea
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/net/sourceforge/schemaspy/SchemaAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,24 @@ private static void dumpNoTablesMessage(String schema, String user, DatabaseMeta
System.out.println();
System.out.println();
System.out.println("No tables or views were found in schema '" + schema + "'.");
List<String> schemas = DbAnalyzer.getSchemas(meta);
if (schema == null || schemas.contains(schema)) {
List<String> schemas = null;
Exception failure = null;
try {
schemas = DbAnalyzer.getSchemas(meta);
} catch (SQLException exc) {
failure = exc;
} catch (RuntimeException exc) {
failure = exc;
}

if (schemas == null) {
System.out.println("The user you specified (" + user + ')');
System.out.println(" might not have rights to read the database metadata.");
System.out.flush();
if (failure != null) // to appease the compiler
failure.printStackTrace();
return;
} else if (schema == null || schemas.contains(schema)) {
System.out.println("The schema exists in the database, but the user you specified (" + user + ')');
System.out.println(" might not have rights to read its contents.");
if (specifiedInclusions) {
Expand Down

0 comments on commit 6a403ea

Please sign in to comment.