{"record":{"id":"99986ca476e3ce05","repo":"pentaho/pentaho-kettle","slug":"error-while-dropping-table","errorCode":null,"errorMessage":"Error while dropping table ","messagePattern":"Error while dropping table ","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/monet-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/monetdbbulkloader/MonetDBBulkLoader.java","lineNumber":409,"sourceCode":"    try {\n      executeSql( cmd );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Error while truncating table \" + table, e );\n    }\n\n    // try to update the metadata registry\n    util.updateMetadata( meta, -1 );\n    if ( log.isDetailed() ) {\n      logDetailed( \"Successfull: \" + cmd );\n    }\n\n  }\n\n  public void drop() throws KettleException {\n    try {\n      executeSql( \"drop table \" + data.schemaTable );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Error while dropping table \" + data.schemaTable, e );\n    }\n\n  }\n\n  public void autoAdjustSchema( MonetDBBulkLoaderMeta meta ) throws KettleException {\n\n    if ( log.isDetailed() ) {\n      logDetailed( \"Attempting to auto adjust table structure\" );\n    }\n\n    drop();\n\n    if ( log.isDetailed() ) {\n      logDetailed( \"getTransMeta: \" + getTransMeta() );\n    }\n    if ( log.isDetailed() ) {\n      logDetailed( \"getStepname: \" + getStepname() );\n    }","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/monet-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/monetdbbulkloader/MonetDBBulkLoader.java#L391-L427","documentation":"This KettleException wraps any failure that occurs while executing the 'DROP TABLE <schema.table>' SQL statement against MonetDB via the MAPI socket in the MonetDBBulkLoader step's drop() method. It is thrown when the underlying MAPI connection cannot be established or the server rejects the DDL statement, and it preserves the original exception as the cause.","triggerScenarios":"autoAdjustSchema() calls drop() to remove the target table before recreation; any exception from executeSql(\"drop table \" + data.schemaTable) - connection failure, authentication failure, insufficient privileges, or table/schema not existing in a state where drop fails - triggers this throw.","commonSituations":"Wrong host/port/credentials in the MonetDB connection definition; the MonetDB server (mserver) is down; the DB user lacks DROP privilege on the schema; the schema or table name encoded in data.schemaTable does not match what exists on the server.","solutions":["Verify the MonetDB connection (host, port, user, password) is correct and the server is reachable, e.g. test with mclient","Check the DB user has DROP/DDL privileges on the target schema","Confirm data.schemaTable matches an existing fully-qualified table name (schema.table)","Read the wrapped cause exception for the exact MAPI/server error message"],"exampleFix":"// before\nexecuteSql( \"drop table \" + data.schemaTable );\n// after\n// guard: only drop if the table actually exists, and fail with server detail\nif ( tableExists( data.schemaTable ) ) {\n  executeSql( \"drop table \" + data.schemaTable );\n}","handlingStrategy":"try-catch","validationCode":"// before running the step, verify connectivity and privileges\nDatabaseMeta dm = meta.getDatabaseMeta();\nif ( dm == null || dm.getHostname() == null ) throw new KettleException( \"No MonetDB connection defined\" );\ntry ( Connection c = dm.getConnection() ) { /* select 1 */ }","typeGuard":"if ( meta == null || meta.getDatabaseMeta() == null ) { skip/repair step configuration; }","tryCatchPattern":"try { loader.drop(); } catch ( KettleException e ) { log.error( \"drop failed for \" + e.getMessage(), e.getCause() ); if ( e.getCause() instanceof SQLException ) handleSql( (SQLException) e.getCause() ); }","preventionTips":["Test the MonetDB connection in the step dialog before running the transformation","Grant the DB user explicit DDL (DROP) privileges on the target schema","Use fully-qualified schema.table names everywhere","Keep mserver reachable: monitor the server and pin host/port in the connection"],"tags":["database","ddl","monetdb","sql"],"backgroundTag":"sql-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"}