{"record":{"id":"563cb67391894409","repo":"pentaho/pentaho-kettle","slug":"unable-to-load-database-connection-info-from-xml-node","errorCode":null,"errorMessage":"Unable to load database connection info from XML node","messagePattern":"Unable to load database connection info from XML node","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/DatabaseMeta.java","lineNumber":1047,"sourceCode":"      setReadOnly( Boolean.valueOf( XMLHandler.getTagValue( con, \"read_only\" ) ) );\n\n      readObjectId( con );\n\n      // Also, read the database attributes...\n      Node attrsnode = XMLHandler.getSubNode( con, \"attributes\" );\n      if ( attrsnode != null ) {\n        List<Node> attrnodes = XMLHandler.getNodes( attrsnode, \"attribute\" );\n        for ( Node attrnode : attrnodes ) {\n          String code = XMLHandler.getTagValue( attrnode, \"code\" );\n          String attribute = XMLHandler.getTagValue( attrnode, \"attribute\" );\n          if ( code != null && attribute != null ) {\n            databaseInterface.addAttribute( code, attribute );\n          }\n          getDatabasePortNumberString();\n        }\n      }\n    } catch ( Exception e ) {\n      throw new KettleXMLException( \"Unable to load database connection info from XML node\", e );\n    }\n  }\n\n  /**\n   * Initialize every attribute\n   */\n  private void setDefaultAttributesValues() {\n    setConnectSQL( \"\" );\n    setInitialPoolSizeString( \"\" );\n    setMaximumPoolSizeString( \"\" );\n    setUsingConnectionPool( false );\n    setForcingIdentifiersToLowerCase( false );\n    setForcingIdentifiersToUpperCase( false );\n    setQuoteAllFields( false );\n    setUsingDoubleDecimalAsSchemaTableSeparator( false );\n    setSupportsBooleanDataType( false );\n    setSupportsTimestampDataType( false );\n  }","sourceCodeStart":1029,"sourceCodeEnd":1065,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/DatabaseMeta.java#L1029-L1065","documentation":"The XML DatabaseMeta constructor catches any Exception raised while parsing the <connection> node (attributes, options, port, attributes section) and rethrows it as KettleXMLException(\"Unable to load database connection info from XML node\"). Unlike error 256, this is a generic wrap for any structural/parse problem in the node, not only a missing database type.","triggerScenarios":"new DatabaseMeta(Node) where the node is malformed or missing expected tags (<name>, <server>, <type>, <attributes>), XMLHandler returns unexpected nulls that cause NPEs downstream, or an attribute element fails parsing.","commonSituations":"Hand-edited transformation XML with removed sections; partial XML generated by older Pentaho versions loaded into newer ones; truncated files or wrong node passed to the constructor.","solutions":["Inspect getCause() of the KettleXMLException — it names the real parse failure.","Validate the XML against a known-good connection node structure (compare with a freshly exported connection).","Regenerate the connection metadata in Spoon and re-export rather than hand-editing XML.","Ensure you pass the correct sub-node (the <connection> element), not the document root."],"exampleFix":"// before\nDatabaseMeta meta = new DatabaseMeta rootNode;\n// after\nNode con = XMLHandler.getSubNode(rootNode, \"connection\");\nif (con == null) { throw new IllegalArgumentException(\"No <connection> node found in document\"); }\ntry {\n  DatabaseMeta meta = new DatabaseMeta(con);\n} catch (KettleXMLException e) {\n  log.logError(\"Bad connection XML: \" + e.getCause(), e);\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (XMLHandler.getSubNode(node, \"connection\") == null && !\"connection\".equals(node.getName())) {\n  throw new IllegalArgumentException(\"Node is not a <connection> element\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  DatabaseMeta meta = new DatabaseMeta(con);\n} catch (KettleXMLException e) {\n  log.error(\"Failed loading connection XML: \" + e.getCause(), e); // cause names the real parse error\n  throw new CorruptConnectionMetadataException(e);\n}","preventionTips":["Always inspect getCause() — the wrapper message hides the real failure.","Pass the <connection> sub-node, not the parent document node.","Keep connection XML generated by the same (or newer) Pentaho version that will load it."],"tags":["xml","deserialization","parse","metadata"],"backgroundTag":"schema-validation-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"}