{"record":{"id":"8948659a2a56d6c2","repo":"pentaho/pentaho-kettle","slug":"mysqlbulkloadermeta-exception-connectionnotdefined","errorCode":"MySQLBulkLoaderMeta.Exception.ConnectionNotDefined","errorMessage":"MySQLBulkLoaderMeta.Exception.ConnectionNotDefined","messagePattern":"MySQLBulkLoaderMeta\\.Exception\\.ConnectionNotDefined","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mysql-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/mysqlbulkloader/MySQLBulkLoaderMeta.java","lineNumber":651,"sourceCode":"        if ( !Utils.isEmpty( realTableName ) ) {\n          String schemaTable = databaseMeta.getQuotedSchemaTableCombination( realSchemaName, realTableName );\n\n          // Check if this table exists...\n          if ( db.checkTableExists( schemaTable ) ) {\n            return db.getTableFields( schemaTable );\n          } else {\n            throw new KettleException( BaseMessages.getString( PKG, \"MySQLBulkLoaderMeta.Exception.TableNotFound\" ) );\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString( PKG, \"MySQLBulkLoaderMeta.Exception.TableNotSpecified\" ) );\n        }\n      } catch ( Exception e ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"MySQLBulkLoaderMeta.Exception.ErrorGettingFields\" ), e );\n      } finally {\n        db.close();\n      }\n    } else {\n      throw new KettleException( BaseMessages.getString( PKG, \"MySQLBulkLoaderMeta.Exception.ConnectionNotDefined\" ) );\n    }\n\n  }\n\n  /**\n   * @return the schemaName\n   */\n  public String getSchemaName() {\n    return schemaName;\n  }\n\n  /**\n   * @param schemaName\n   *          the schemaName to set\n   */\n  public void setSchemaName( String schemaName ) {\n    this.schemaName = schemaName;\n  }","sourceCodeStart":633,"sourceCodeEnd":669,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mysql-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/mysqlbulkloader/MySQLBulkLoaderMeta.java#L633-L669","documentation":"At the start of getRequiredFields the step checks whether a databaseMeta (connection) is defined; if not it throws a KettleException with 'MySQLBulkLoaderMeta.Exception.ConnectionNotDefined'. Without a connection the step cannot look up the target table's required fields.","triggerScenarios":"Calling getRequiredFields when the step's database connection has never been set (databaseMeta == null).","commonSituations":"Newly dropped step with no connection selected; transformation moved to another environment where connection definitions were not migrated; connection deleted from the shared connections tree.","solutions":["Select a valid MySQL connection in the MySQL Bulk Loader step dialog","Ensure the transformation/job defines the connection (or that environment migration carried shared connections over)"],"exampleFix":"// before\nmeta.setDatabaseMeta( null );\n// after\nmeta.setDatabaseMeta( transMeta.findDatabaseConnection( \"MySQL-Local\" ) );","handlingStrategy":"validation","validationCode":"if ( meta.getDatabaseMeta() == null ) {\n  throw new KettleException( \"Select a database connection first\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  meta.getRequiredFields( transMeta );\n} catch ( KettleException e ) {\n  logError( \"Connection not defined: \" + e.getMessage() );\n}","preventionTips":["Never save a loader step without selecting a connection","When exporting/migrating transformations, include shared connections","Check connections exist in the target environment before deployment"],"tags":["kettle","mysql","missing-config","connection"],"backgroundTag":"missing-required-config-field","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"}