pentaho/pentaho-kettle · error · KettleDatabaseException
: Unable to set Internet address value on prepared…
Error message
: Unable to set Internet address value on prepared statement on index " + index
What it means
setPreparedStatementValue() binds the address by converting it to its String form and calling setObject(index, value, Types.OTHER). Any failure — driver rejection of Types.OTHER, closed statement, type incompatibility — is wrapped in KettleDatabaseException 'Unable to set Internet address value on prepared statement on index N'.
Solutions
- Cast the value in the SQL itself (e.g., '?::inet' on PostgreSQL) or use a String-typed field and let the DB cast
- Change the target column to VARCHAR and store the textual address
- Verify the JDBC driver version supports setObject with Types.OTHER for the column type
- Catch KettleDatabaseException and check connection/statement state before retrying
Example fix
// before "INSERT INTO hosts(ip) VALUES (?)" // bound with Types.OTHER // after "INSERT INTO hosts(ip) VALUES (CAST(? AS inet))" // or store into a varchar column
Defensive patterns
Strategy: try-catch
Validate before calling
// verify driver accepts Types.OTHER for the column DatabaseMetaData dmd = conn.getMetaData(); boolean ok = dmd != null; // plus test setObject once per connection
Try / catch
try { ps.setObject(idx, val, Types.OTHER); } catch (SQLException e) { ps.setObject(idx, val, Types.VARCHAR); } Prevention
- Cast in SQL ('?::inet') instead of relying on Types.OTHER
- Store addresses as VARCHAR when the DB lacks an inet type
- Use a recent JDBC driver
- Check connection health before batch writes
When it happens
Trigger: Executing inserts/updates through a prepared statement where the target column type or JDBC driver does not accept a String bound with Types.OTHER (e.g., drivers lacking inet type mapping), or the statement is invalid/closed.
Common situations: Writing IP values into PostgreSQL 'inet' columns with drivers expecting typed parameters; databases with no inet datatype (MySQL, Oracle) rejecting Types.OTHER; prepared statement reused after connection failure.
Related errors
- : Unable to get Internet Address from resultset at index "…
- Unable to prepare statement for SQL statement [
- Couldn't prepare statement:
- Error evaluating Internet address value metadata
- Error updating batch
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/8e70daff5dd29a23.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaInternetAddress.java:528
return convertStringToInternetAddress( resultSet.getString( index + 1 ) );
} catch ( Exception e ) {
throw new KettleDatabaseException( toStringMeta()
+ " : Unable to get Internet Address from resultset at index " + index, e );
}
}
@Override
public void setPreparedStatementValue( DatabaseMeta databaseMeta, PreparedStatement preparedStatement,
int index, Object data ) throws KettleDatabaseException {
try {
preparedStatement.setObject( index, getString( data ), Types.OTHER );
} catch ( Exception e ) {
throw new KettleDatabaseException( toStringMeta()
+ " : Unable to set Internet address value on prepared statement on index " + index, e );
}
}
@Override
public String getDatabaseColumnTypeDefinition( DatabaseInterface databaseInterface, String tk, String pk,
boolean use_autoinc, boolean add_fieldname, boolean add_cr ) {
String retval = null;
if ( databaseInterface instanceof PostgreSQLDatabaseMeta ) {
if ( add_fieldname ) {
retval = getName() + " ";
} else {
retval = "";
}
retval += "INET";
if ( add_cr ) {View on GitHub (pinned to f3058517a1)