{"record":{"id":"742cf06e3985eadc","repo":"pentaho/pentaho-kettle","slug":"mysqlbulkloadermeta-getsql-noconnectiondefined","errorCode":"MySQLBulkLoaderMeta.GetSQL.NoConnectionDefined","errorMessage":"MySQLBulkLoaderMeta.GetSQL.NoConnectionDefined","messagePattern":"MySQLBulkLoaderMeta\\.GetSQL\\.NoConnectionDefined","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mysql-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/mysqlbulkloader/MySQLBulkLoader.java","lineNumber":456,"sourceCode":"        }\n        data.sqlRunner.checkExcn();\n      } catch ( Exception loadEx ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"MySQLBulkLoader.Message.ERRORSERIALIZING\" ), loadEx );\n      }\n\n      // MySQL didn't finish, throw the generic \"Pipe\" exception.\n      throw new KettleException( BaseMessages.getString( PKG, \"MySQLBulkLoader.Message.ERRORSERIALIZING\" ), e );\n\n    } catch ( Exception e2 ) {\n      // Null pointer exceptions etc.\n      throw new KettleException( BaseMessages.getString( PKG, \"MySQLBulkLoader.Message.ERRORSERIALIZING\" ), e2 );\n    }\n  }\n\n  protected void verifyDatabaseConnection() throws KettleException {\n    // Confirming Database Connection is defined.\n    if ( meta.getDatabaseMeta() == null ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"MySQLBulkLoaderMeta.GetSQL.NoConnectionDefined\" ) );\n    }\n  }\n\n  @Override\n  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {\n    meta = (MySQLBulkLoaderMeta) smi;\n    data = (MySQLBulkLoaderData) sdi;\n\n    if ( super.init( smi, sdi ) ) {\n\n      // Confirming Database Connection is defined.\n      try {\n        verifyDatabaseConnection();\n      } catch ( KettleException ex ) {\n        logError( ex.getMessage() );\n        return false;\n      }\n","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mysql-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/mysqlbulkloader/MySQLBulkLoader.java#L438-L474","documentation":"verifyDatabaseConnection throws this KettleException when the step's metadata has no database connection defined (meta.getDatabaseMeta() == null). The MySQL Bulk Loader cannot bulk-load without a target MySQL connection, so init() aborts the step before any rows are processed. The message text comes from the MySQLBulkLoaderMeta message bundle.","triggerScenarios":"init() -> verifyDatabaseConnection() runs during transformation initialization and MySQLBulkLoaderMeta.getDatabaseMeta() returns null because no database connection was assigned to the step.","commonSituations":"Transformation exported/imported without the connection definition; the connection was deleted from the repository after the transformation was saved; step metadata copied between transformations where the connection reference didn't resolve; programmatically generated transformations that never set the database meta.","solutions":["Open the MySQL Bulk Loader step in Spoon and select/assign a valid MySQL database connection, then save and re-run.","Verify the connection still exists in the repository/environment the transformation runs in (a missing shared connection resolves to null).","If the transformation is generated programmatically, call meta.setDatabaseMeta(databaseMeta) before executing.","For repository-based runs, re-export with shared connections included so the reference resolves."],"exampleFix":"// before: running a transformation whose bulk loader step has no connection\nStepMeta bulkStep = new StepMeta( \"bulk loader\", new MySQLBulkLoaderMeta() );\n// after: always set (and check) the connection before execution\nMySQLBulkLoaderMeta meta = new MySQLBulkLoaderMeta();\nif ( meta.getDatabaseMeta() == null ) {\n  meta.setDatabaseMeta( DatabaseMeta.findDatabase( databases, \"MySQL-Conn\" ) );\n}","handlingStrategy":"validation","validationCode":"// Before running the transformation, verify the step's connection resolves\nDatabaseMeta dbMeta = meta.getDatabaseMeta();\nif ( dbMeta == null ) {\n  throw new IllegalStateException(\n    \"MySQL Bulk Loader step has no database connection defined; assign one before executing.\" );\n}","typeGuard":"boolean hasConnection( MySQLBulkLoaderMeta meta ) {\n  return meta != null && meta.getDatabaseMeta() != null;\n}","tryCatchPattern":"try {\n  transformation.execute( null );\n} catch ( KettleException e ) {\n  if ( String.valueOf( e.getMessage() ).contains( \"NoConnectionDefined\" ) ) {\n    log.error( \"Assign a MySQL connection to the bulk loader step and re-run.\" );\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always assign a database connection in the step dialog before saving.","When exporting/importing transformations, include shared connections or use environment-aware connection names.","Verify connections exist in the target repository/environment before kitchen/pan runs.","When building transformations programmatically, call setDatabaseMeta() before execution."],"tags":["mysql","configuration","missing-connection","initialization"],"backgroundTag":"missing-required-config","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"}