pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to get value ' ' from database resultset, index

Error message

Unable to get value '<valueMeta>' from database resultset, index <index>

What it means

AzureSqlDataBaseMeta.getValueFromResultSet extracts a typed value from a JDBC ResultSet for the given ValueMetaInterface at the given index. Any SQLException thrown during that extraction is wrapped in a KettleDatabaseException carrying the value's metadata name and the column index, so callers know which field failed.

Solutions

  1. Update the Microsoft mssql-jdbc driver to the latest version compatible with your Azure SQL server.
  2. Ensure the row metadata (ValueMetaInterface types) matches the actual SELECT column types.
  3. Verify the connection is still alive and increase socket/query timeouts for large result sets.
  4. Catch KettleDatabaseException in the step processing loop and log the failing column index for diagnosis.

Example fix

// before
String sql = "SELECT myDatetime2Col FROM t"; // declared as Timestamp with old driver

// after
String sql = "SELECT CAST(myDatetime2Col AS datetime) FROM t"; // match meta type, upgrade driver
Defensive patterns

Strategy: try-catch

Validate before calling

// before reading rows, confirm the value meta types match the ResultSet
for (int i = 0; i < rowMeta.size(); i++) {
  int sqlType = rs.getMetaData().getColumnType(i + 1);
  // compare with rowMeta.getValueMeta(i).getType() and fail fast on mismatch
}

Try / catch

try {
  Object v = meta.getValueFromResultSet(rs, val, i);
} catch (KettleDatabaseException e) {
  LOG.error("Failed reading column index " + i + " (" + val + ") from Azure SQL", e);
  throw e;
}

Prevention

When it happens

Trigger: Reading a row from an Azure SQL query result where the JDBC driver throws SQLException on rs.getXxx(index) — e.g. type mismatch between the ValueMeta type and the actual column type, or the connection broke mid-read.

Common situations: Querying Azure SQL where a column's actual SQL type does not match the declared ValueMeta (e.g. reading a DATETIME2 as java.sql.Timestamp with an old driver); connection dropped during large result streaming; incompatible mssql-jdbc driver versions.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/bc49bc00e3a57200. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/database/AzureSqlDataBaseMeta.java:94

   * @param index
   *          the index on which we need to retrieve the value, 0-based.
   * @return The correctly converted Kettle data type corresponding to the valueMeta description.
   * @throws KettleDatabaseException
   */
  @Override
  public Object getValueFromResultSet( ResultSet rs, ValueMetaInterface val, int index ) throws KettleDatabaseException {
    Object data;
    try {
      if ( val.getType() == ValueMetaInterface.TYPE_BINARY ) {
        data = rs.getString( index + 1 );
      } else {
        return super.getValueFromResultSet( rs, val, index );
      }
      if ( rs.wasNull() ) {
        data = null;
      }
    } catch ( SQLException e ) {
      throw new KettleDatabaseException( "Unable to get value '"
          + val.toStringMeta() + "' from database resultset, index " + index, e );
    }
    return data;
  }

  @Override
  public String getXulOverlayFile() {
    return "azuresqldb";
  }

  @Override
  public void setConnectionSpecificInfoFromAttributes( Map<String, String> attributes ) {
    addAttribute( JDBC_AUTH_METHOD, setStringValueFromMap( attributes, JDBC_AUTH_METHOD ) );
    addAttribute( CLIENT_ID, setStringValueFromMap( attributes, CLIENT_ID ) );
    addAttribute( CLIENT_SECRET_KEY, setStringValueFromMap( attributes, CLIENT_SECRET_KEY ) );
    addAttribute( IS_ALWAYS_ENCRYPTION_ENABLED, setStringValueFromMap( attributes, IS_ALWAYS_ENCRYPTION_ENABLED ) );
  }
}

View on GitHub (pinned to f3058517a1)