{"record":{"id":"f8acd7c0f7e60f90","repo":"pentaho/pentaho-kettle","slug":"database-type-not-found-databasemeta","errorCode":null,"errorMessage":"Database type [] not found!","messagePattern":"Database type \\[\\] not found!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/DatabaseMeta.java","lineNumber":654,"sourceCode":"\n    setName( name );\n    setAccessType( getAccessType( access ) );\n    setHostname( host );\n    setDBName( db );\n    setDBPort( port );\n    setUsername( user );\n    setPassword( pass );\n    setServername( null );\n    setChanged( false );\n  }\n\n  public void setDatabaseType( String type ) {\n    DatabaseInterface oldInterface = databaseInterface;\n\n    try {\n      databaseInterface = getDatabaseInterface( type );\n    } catch ( KettleDatabaseException kde ) {\n      throw new RuntimeException( \"Database type [\" + type + \"] not found!\", kde );\n    }\n\n    setName( oldInterface.getName() );\n    setDisplayName( oldInterface.getDisplayName() );\n    setAccessType( oldInterface.getAccessType() );\n    setHostname( oldInterface.getHostname() );\n    setDBName( oldInterface.getDatabaseName() );\n    setDBPort( oldInterface.getDatabasePortNumberString() );\n    setUsername( oldInterface.getUsername() );\n    setPassword( oldInterface.getPassword() );\n    setServername( oldInterface.getServername() );\n    setDataTablespace( oldInterface.getDataTablespace() );\n    setIndexTablespace( oldInterface.getIndexTablespace() );\n    setChanged( oldInterface.isChanged() );\n  }\n\n  public void setValues( DatabaseMeta info ) {\n    databaseInterface = (DatabaseInterface) info.databaseInterface.clone();","sourceCodeStart":636,"sourceCodeEnd":672,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/DatabaseMeta.java#L636-L672","documentation":"DatabaseMeta.setDatabaseType(type) swaps the underlying DatabaseInterface by calling getDatabaseInterface(type); on KettleDatabaseException it throws RuntimeException(\"Database type [type] not found!\") including the offending type in the message. The connection keeps its previous interface state; the swap never happened.","triggerScenarios":"Calling setDatabaseType with an unregistered type string; triggered from Spoon UI getInfo/setUp paths, test harnesses (testSetDatabaseType), XML converters (dataNodeToElement), and command-line main().","commonSituations":"User edits connection type in code to a value from a different Pentaho install that has extra plugins; automated scripts deriving type names from DB vendor names that don't match plugin ids; renamed ids across versions.","solutions":["Validate with DatabaseMeta.findDatabaseInterface(type) != null before calling setDatabaseType.","Use plugin ids (e.g. \"POSTGRESQL\") rather than display names when in doubt.","Install the missing database plugin and restart.","Catch RuntimeException around setDatabaseType if the type is user-supplied, and surface a friendly message."],"exampleFix":"// before\nmeta.setDatabaseType(userSelectedType);\n// after\nif (DatabaseMeta.findDatabaseInterface(userSelectedType) == null) {\n  throw new IllegalArgumentException(\"Unknown database type: \" + userSelectedType +\n     \"; available: \" + DatabaseMeta.getDatabaseInterfaces().keySet());\n}\nmeta.setDatabaseType(userSelectedType);","handlingStrategy":"try-catch","validationCode":"if (DatabaseMeta.findDatabaseInterface(newType) == null) {\n  throw new IllegalArgumentException(\"Cannot switch to unknown database type: \" + newType);\n}","typeGuard":null,"tryCatchPattern":"try {\n  meta.setDatabaseType(userType);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Database type [\")) {\n    // keep old interface; rethrow as user-facing validation error\n    throw new InvalidDatabaseTypeException(userType, e.getCause());\n  }\n  throw e;\n}","preventionTips":["Never pass raw user input as type; validate against getDatabaseInterfaces().keySet().","Remember setDatabaseType leaves the old interface intact on failure — re-validate before retrying.","Centralize type switching in one helper that does the lookup check."],"tags":["database","runtime-exception","invalid-type","plugin"],"backgroundTag":"invalid-argument-value","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"}