code: public static PreparedStatement prepareInformationSchemaStatement(Connection connection,String catalog,
                                                                        String schema, String table,
                                                                        String informationSchemaTable,
                                                                        String endQuery, String catalog_field,
                                                                        String schema_field, String table_field)
              throws SQLException {
          Integer catalogIndex = null;
          Integer schemaIndex = null;
          Integer tableIndex = 1;
          StringBuilder sb = new StringBuilder("SELECT * from "+informationSchemaTable+" where ");
          if(!catalog.isEmpty()) {
              sb.append("UPPER(");
              sb.append(catalog_field);
              sb.append(") = ? AND ");
              catalogIndex = 1;
              tableIndex++;
          }
          if(!schema.isEmpty()) {
              sb.append("UPPER(");
              sb.append(schema_field);
              sb.append(") = ? AND ");
              schemaIndex = tableIndex;
              tableIndex++;
          }
          sb.append("UPPER(");
          sb.append(table_field);
          sb.append(") = ? ");
          sb.append(endQuery);
          PreparedStatement preparedStatement = connection.prepareStatement(sb.toString());
          if(catalogIndex!=null) {
              preparedStatement.setString(catalogIndex, catalog.toUpperCase());
          }
          if(schemaIndex!=null) {
              preparedStatement.setString(schemaIndex, schema.toUpperCase());
          }
          preparedStatement.setString(tableIndex, table.toUpperCase());
          return preparedStatement;
      }
docs: For table containing catalog, schema and table name, this function create a prepared statement with a filter
  on this combination.
  
  @param connection Active connection
  @param catalog Table catalog, may be empty
  @param schema Table schema, may be empty
  @param table Table name
  @param informationSchemaTable Information table location
  @param endQuery Additional where statement
  @param catalog_field Catalog field name
  @param schema_field Schema field name
  @param table_field Table field name
  
  @return Prepared statement
  
  @throws SQLException