{"record":{"id":"81311222e69e7e55","repo":"pentaho/pentaho-kettle","slug":"e-tostring","errorCode":null,"errorMessage":"e.toString()","messagePattern":"e\\.toString\\(\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java","lineNumber":526,"sourceCode":"          if ( rs != null ) {\n            List<Object[]> list = new ArrayList<Object[]>();\n            while ( rs.next() ) {\n              Object[] objRow = new Object[columnCount];\n              for ( int i = 0; i < columnCount; i++ ) {\n                objRow[i] = rs.getObject( i + 1 );\n              }\n              list.add( objRow );\n            }\n            Object[][] resultArr = new Object[list.size()][];\n            list.toArray( resultArr );\n            db.close();\n            return resultArr;\n          }\n        } catch ( Exception er ) {\n          throw new RuntimeException( er.toString() );\n        }\n      } catch ( Exception e ) {\n        throw new RuntimeException( e.toString() );\n      }\n    } else {\n      throw new RuntimeException( \"The function call fireToDB requires 2 arguments.\" );\n    }\n    return oRC;\n  }\n\n  public static Object dateDiff( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,\n    Object FunctionContext ) {\n    if ( ArgList.length == 3 ) {\n      try {\n        if ( isNull( ArgList, new int[] { 0, 1, 2 } ) ) {\n          return new Double( Double.NaN );\n        } else if ( isUndefined( ArgList, new int[] { 0, 1, 2 } ) ) {\n          return undefinedValue;\n        } else {\n          java.util.Date dIn1 = (java.util.Date) ArgList[0];\n          java.util.Date dIn2 = (java.util.Date) ArgList[1];","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java#L508-L544","documentation":"The outer try in fireToDB covers setup steps such as obtaining the step reference, resolving the DatabaseMeta, opening the Database connection, and setting the query limit. Any exception raised there is rethrown as RuntimeException(e.toString()), flattening the original exception into a bare string.","triggerScenarios":"Failures before SQL execution: _step_ binding missing, shareVariablesWith or Database construction failed, or the Database connection could not be opened (bad host, port, credentials, driver).","commonSituations":"Database server unreachable; wrong JDBC driver; invalid credentials; transformation executed in a context where the step binding is unavailable.","solutions":["Decode the embedded exception message to identify the connection or setup failure.","Verify host, port, database name, user and password on the named connection.","Confirm the JDBC driver jar is present on the classpath/lib directory.","Test the connection from the Database Connection dialog before scripting against it."],"exampleFix":"// before\nfireToDB('MyConn', sql); // connection not opened\n// after\n// Test/fix the MyConn connection (host, port, credentials, driver), then rerun:\nfireToDB('MyConn', sql);","handlingStrategy":"try-catch","validationCode":"// pre-check connection settings before fireToDB\nvar ok = _step_.getTransMeta().findDatabase('MyConn') != null;","typeGuard":null,"tryCatchPattern":"try { fireToDB('MyConn', sql); } catch (e) { var setupErr = String(e); /* handle connection/setup failure, e.g. retry or alert */ }","preventionTips":["Test DB connectivity (host, port, credentials, driver) before scheduling transformations.","Keep JDBC drivers in the lib directory and current.","Log connection parameters at debug level during development."],"tags":["database","connection","script-step"],"backgroundTag":"database-query-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"}