public void testBug23304() throws Exception {
  if (!versionMeetsMinimum(5,0)) {
    return;
  }
  Connection connShow=null;
  Connection connInfoSchema=null;
  ResultSet rsShow=null;
  ResultSet rsInfoSchema=null;
  try {
    Properties noInfoSchemaProps=new Properties();
    noInfoSchemaProps.setProperty("useInformationSchema","false");
    Properties infoSchemaProps=new Properties();
    infoSchemaProps.setProperty("useInformationSchema","true");
    infoSchemaProps.setProperty("dumpQueriesOnException","true");
    connShow=getConnectionWithProps(noInfoSchemaProps);
    connInfoSchema=getConnectionWithProps(infoSchemaProps);
    DatabaseMetaData dbmdUsingShow=connShow.getMetaData();
    DatabaseMetaData dbmdUsingInfoSchema=connInfoSchema.getMetaData();
    assertNotSame(dbmdUsingShow.getClass(),dbmdUsingInfoSchema.getClass());
    rsShow=dbmdUsingShow.getSchemas();
    rsInfoSchema=dbmdUsingInfoSchema.getSchemas();
    compareResultSets(rsShow,rsInfoSchema);
    createTable("t_testBug23304","(field1 int primary key not null, field2 tinyint, field3 mediumint, field4 mediumint, field5 bigint, field6 float, field7 double, field8 decimal, field9 char(32), field10 varchar(32), field11 blob, field12 mediumblob, field13 longblob, field14 text, field15 mediumtext, field16 longtext, field17 date, field18 time, field19 datetime, field20 timestamp)");
    rsShow=dbmdUsingShow.getColumns(connShow.getCatalog(),null,"t_testBug23304","%");
    rsInfoSchema=dbmdUsingInfoSchema.getColumns(connInfoSchema.getCatalog(),null,"t_testBug23304","%");
    compareResultSets(rsShow,rsInfoSchema);
  }
  finally {
    if (rsShow != null) {
      rsShow.close();
    }
    if (rsInfoSchema != null) {
      rsInfoSchema.close();
    }
  }
}

public void testBug23304 ( ) throws Exception { if ( ! versionMeetsMinimum ( 5 , 0 ) ) { return ; } Connection connShow = null ; Connection connInfoSchema = null ; ResultSet rsShow = null ; ResultSet rsInfoSchema = null ; try { Properties noInfoSchemaProps = new Properties ( ) ; noInfoSchemaProps . setProperty ( "useInformationSchema" , "false" ) ; Properties infoSchemaProps = new Properties ( ) ; infoSchemaProps . setProperty ( "useInformationSchema" , "true" ) ; infoSchemaProps . setProperty ( "dumpQueriesOnException" , "true" ) ; connShow = getConnectionWithProps ( noInfoSchemaProps ) ; connInfoSchema = getConnectionWithProps ( infoSchemaProps ) ; DatabaseMetaData dbmdUsingShow = connShow . getMetaData ( ) ; DatabaseMetaData dbmdUsingInfoSchema = connInfoSchema . getMetaData ( ) ; assertNotSame ( dbmdUsingShow . getClass ( ) , dbmdUsingInfoSchema . getClass ( ) ) ; rsShow = dbmdUsingShow . getSchemas ( ) ; rsInfoSchema = dbmdUsingInfoSchema . getSchemas ( ) ; compareResultSets ( rsShow , rsInfoSchema ) ; createTable ( "t_testBug23304" , "(field1 int primary key not null, field2 tinyint, field3 mediumint, field4 mediumint, field5 bigint, field6 float, field7 double, field8 decimal, field9 char(32), field10 varchar(32), field11 blob, field12 mediumblob, field13 longblob, field14 text, field15 mediumtext, field16 longtext, field17 date, field18 time, field19 datetime, field20 timestamp)" ) ; rsShow = dbmdUsingShow . getColumns ( connShow . getCatalog ( ) , null , "t_testBug23304" , "%" ) ; rsInfoSchema = dbmdUsingInfoSchema . getColumns ( connInfoSchema . getCatalog ( ) , null , "t_testBug23304" , "%" ) ; compareResultSets ( rsShow , rsInfoSchema ) ; } finally { if ( rsShow != null ) { rsShow . close ( ) ; } if ( rsInfoSchema != null ) { rsInfoSchema . close ( ) ; } } }
tests fix for bug # 23304 - dbmd using " show " and dbmd using information_schema do not return results consistent with eachother . ( note this fix only addresses the inconsistencies , not the issue that the driver is treating schemas differently than some users expect . we will revisit this behavior when there is full support for schemas in mysql ) .
