jdbc-protolib/src/main/java/com/streamsets/pipeline/lib/jdbc/JdbcBaseRecordWriter.java
private void createDefaultFieldMappings() throws StageException {
    try (Connection connection = dataSource.getConnection()) {
      try (ResultSet res = jdbcUtil.getTableMetadata(connection, schema, tableName)) {
        if (!res.next()) {
          throw new StageException(JdbcErrors.JDBC_16, getTableName());
        }
      }

      try (ResultSet columns = jdbcUtil.getColumnMetadata(connection, schema, tableName)) {
        while (columns.next()) {
          String columnName = columns.getString(COLUMN_NAME);
          columnsToFields.put(columnName, "/" + columnName); // Default implicit field mappings
          columnsToParameters.put(columnName, "?");
          columnType.put(columnName, columns.getInt(DATA_TYPE));
        }
      }
    } catch (SQLException e) {
      String errorMessage = jdbcUtil.formatSqlException(e);
      LOG.error(errorMessage);
      LOG.debug(errorMessage, e);
      throw new StageException(JdbcErrors.JDBC_09, tableName);
    }
  }
private void createDefaultFieldMappings() throws StageException {
    try (Connection connection = dataSource.getConnection()) {
      try (ResultSet res = jdbcUtil.getTableMetadata(connection, schema, tableName)) {
        if (!res.next()) {
          throw new StageException(JdbcErrors.JDBC_16, getTableName());
        }
      }

      try (ResultSet columns = jdbcUtil.getColumnMetadata(connection, schema, tableName)) {
        while (columns.next()) {
          String columnName = columns.getString(COLUMN_NAME);
          columnsToFields.put(columnName, "/" + columnName); // Default implicit field mappings
          columnsToParameters.put(columnName, "?");
          columnType.put(columnName, columns.getInt(DATA_TYPE));
        }
      }
    } catch (SQLException e) {
      String errorMessage = jdbcUtil.formatSqlException(e);
      LOG.error(errorMessage);
      LOG.debug(errorMessage, e);
      throw new StageException(JdbcErrors.JDBC_09, tableName);
    }
  }
private void createDefaultFieldMappings ( ) throws StageException { try ( Connection connection = dataSource . getConnection ( ) ) { try ( ResultSet res = jdbcUtil . getTableMetadata ( connection , schema , tableName ) ) { if ( ! res . next ( ) ) { throw new StageException ( JdbcErrors . JDBC_16 , getTableName ( ) ) ; } } try ( ResultSet columns = jdbcUtil . getColumnMetadata ( connection , schema , tableName ) ) { while ( columns . next ( ) ) { String columnName = columns . getString ( COLUMN_NAME ) ; columnsToFields . put ( columnName , "/" + columnName ) ; // Default implicit field mappings columnsToParameters . put ( columnName , "?" ) ; columnType . put ( columnName , columns . getInt ( DATA_TYPE ) ) ; } } } catch ( SQLException e ) { String errorMessage = jdbcUtil . formatSqlException ( e ) ; LOG . error ( errorMessage ) ; LOG . debug ( errorMessage , e ) ; throw new StageException ( JdbcErrors . JDBC_09 , tableName ) ; } }
Access database and obtain the metadata for the table.
Store columnName and "/columnName" to the columnsToFields map as a default column-to-field mapping.
Store columnName and "?" to columnsToParameters map as a default column-to-value mapping.
They will be updated later in createCustomFieldMappings().

@throws StageException
Access database and obtain the metadata for the table . Store columnName and / columnName to the columnsToFields map as a default column - to - field mapping . Store columnName and ? to columnsToParameters map as a default column - to - value mapping . They will be updated later in createCustomFieldMappings () .