{"record":{"id":"5aca46465b961247","repo":"pentaho/pentaho-kettle","slug":"unable-to-get-internet-address-from-resultset-at-index-index","errorCode":null,"errorMessage":" : Unable to get Internet Address from resultset at index \" + index","messagePattern":" : Unable to get Internet Address from resultset at index \" \\+ index","errorType":"exception","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaInternetAddress.java","lineNumber":513,"sourceCode":"          getOriginalColumnMetadata( valueMeta, rm, index, ignoreLength );\n          return valueMeta;\n        }\n      }\n      return null;\n    } catch ( Exception e ) {\n      throw new KettleDatabaseException( \"Error evaluating Internet address value metadata\", e );\n    }\n  }\n\n  @Override\n  public Object getValueFromResultSet( DatabaseInterface databaseInterface, ResultSet resultSet, int index ) throws KettleDatabaseException {\n\n    try {\n\n      return convertStringToInternetAddress( resultSet.getString( index + 1 ) );\n\n    } catch ( Exception e ) {\n      throw new KettleDatabaseException( toStringMeta()\n        + \" : Unable to get Internet Address from resultset at index \" + index, e );\n    }\n\n  }\n\n  @Override\n  public void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement,\n    int index, Object data ) throws KettleDatabaseException {\n\n    try {\n\n      preparedStatement.setObject( index, getString( data ), Types.OTHER );\n\n    } catch ( Exception e ) {\n      throw new KettleDatabaseException( toStringMeta()\n        + \" : Unable to set Internet address value on prepared statement on index \" + index, e );\n    }\n","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaInternetAddress.java#L495-L531","documentation":"getValueFromResultSet() reads the column as a String and parses it to an InetAddress. Any JDBC failure (invalid index, closed result set, driver errors) or unparseable address string is wrapped in KettleDatabaseException 'Unable to get Internet Address from resultset at index N'.","triggerScenarios":"Reading a row from a ResultSet where index is out of range, the statement/result set is closed, or the column value is not a valid IP literal string.","commonSituations":"Queries whose select-list changed after the row meta was built (index mismatch); database columns containing hostnames or malformed IPs; connection dropped mid-fetch.","solutions":["Ensure the row metadata indices match the actual query select-list order","Sanitize/standardize the column contents in the database or via SQL CAST/expression","Catch KettleDatabaseException and use error handling to capture failing rows","Verify the connection is alive and the ResultSet is not consumed out of order"],"exampleFix":"// before\nObject v = inetMeta.getValueFromResultSet(dbInterface, rs, idx);\n// after\nObject v;\ntry { v = inetMeta.getValueFromResultSet(dbInterface, rs, idx); }\ncatch (KettleDatabaseException e) { v = null; log.warn(\"IP read failed at \" + idx + \": \" + e.getMessage()); }","handlingStrategy":"try-catch","validationCode":"int colCount = rs.getMetaData().getColumnCount();\nboolean ok = index >= 0 && index < colCount && !rs.isClosed();","typeGuard":"boolean readable(ResultSet rs, int idx) throws SQLException { return !rs.isClosed() && idx >= 0 && idx < rs.getMetaData().getColumnCount(); }","tryCatchPattern":"try { v = inetMeta.getValueFromResultSet(dbIface, rs, idx); } catch (KettleDatabaseException e) { v = null; log.warn(...); }","preventionTips":["Keep row meta in sync with the actual SELECT list","Sanitize IP columns in the database","Handle dropped connections with reconnect + re-fetch logic"],"tags":["database","jdbc","resultset","inetaddress","kettle"],"backgroundTag":"database-query-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}