{"record":{"id":"2edd7ce1724d9ce2","repo":"pentaho/pentaho-kettle","slug":"pgbulkloadermeta-getsql-noconnectiondefined","errorCode":"PGBulkLoaderMeta.GetSQL.NoConnectionDefined","errorMessage":"PGBulkLoaderMeta.GetSQL.NoConnectionDefined","messagePattern":"PGBulkLoaderMeta\\.GetSQL\\.NoConnectionDefined","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/postgresql-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/pgbulkloader/PGBulkLoader.java","lineNumber":431,"sourceCode":"            default:\n              throw new KettleException( \"PGBulkLoader doesn't handle the type \" + valueMeta.getTypeDesc() );\n          }\n        }\n      }\n\n      // Now write a newline\n      //\n      pgCopyOut.write( data.newline );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Error serializing rows of data to the COPY command\", e );\n    }\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, \"PGBulkLoaderMeta.GetSQL.NoConnectionDefined\" ) );\n    }\n  }\n\n  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {\n    meta = (PGBulkLoaderMeta) smi;\n    data = (PGBulkLoaderData) sdi;\n\n    String enclosure = environmentSubstitute( meta.getEnclosure() );\n    String separator = environmentSubstitute( meta.getDelimiter() );\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;","sourceCodeStart":413,"sourceCodeEnd":449,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/postgresql-db-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/pgbulkloader/PGBulkLoader.java#L413-L449","documentation":"verifyDatabaseConnection, called from init, throws when the step has no database connection configured (meta.getDatabaseMeta() == null). The localized key PGBulkLoaderMeta.GetSQL.NoConnectionDefined names the condition; without a connection the loader cannot build or run anything.","triggerScenarios":"init() runs on a PGBulkLoader step whose Database connection field was never set — new step added but never configured, or a transformation where the connection definition was deleted.","commonSituations":"Copying a step into another transformation that lacks the referenced database connection; repository export missing the connection; programmatically building StepMeta without calling setDatabaseMeta.","solutions":["Open the step dialog and select a database connection on the 'General' tab, then re-save the transformation","Define/import the missing database connection in the transformation's connection list","When building metadata programmatically, call meta.setDatabaseMeta( databaseMeta ) before running","Validate transformations at design time so unconfigured connections fail fast"],"exampleFix":"// before\nPGBulkLoaderMeta meta = new PGBulkLoaderMeta();\n// after\nmeta.setDatabaseMeta( new DatabaseMeta( \"pg\", \"PostgreSQL\", \"Native\", \"host\", \"db\", \"5432\", \"user\", \"pass\" ) );","handlingStrategy":"validation","validationCode":"PGBulkLoaderMeta meta = (PGBulkLoaderMeta) stepMeta.getStepMetaInterface();\nif ( meta.getDatabaseMeta() == null ) {\n  throw new IllegalStateException( \"PGBulkLoader step has no database connection configured\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  transformation.execute( null );\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"NoConnectionDefined\" ) ) {\n    // attach a DatabaseMeta and retry\n  }\n}","preventionTips":["Set the connection in the step dialog immediately after adding the step","When copying steps across transformations, verify the connection exists in the target","Programmatically always call setDatabaseMeta before execution","Add design-time validation of transformation steps before scheduling"],"tags":["kettle","configuration","database-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"}