{"record":{"id":"89f0ee2fdd15d115","repo":"pentaho/pentaho-kettle","slug":"unable-to-construct-a-jdbc-url-at-least-the-database-name","errorCode":null,"errorMessage":"Unable to construct a JDBC URL: at least the database name must be specified","messagePattern":"Unable to construct a JDBC URL: at least the database name must be specified","errorType":"validation","errorClass":"KettleDatabaseException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/database/OracleDatabaseMeta.java","lineNumber":148,"sourceCode":"      } else {\n        // by default we assume a SID\n        return \"jdbc:oracle:thin:@\" + hostname + \":\" + port + \":\" + databaseName;\n      }\n    } else {\n      // OCI\n      // Let's see if we have an database name\n      if ( databaseName != null && databaseName.length() > 0 ) {\n        // Has the user specified hostname & port number?\n        if ( hostname != null && hostname.length() > 0 && port != null && port.length() > 0 ) {\n          // User wants the full url\n          return \"jdbc:oracle:oci:@(description=(address=(host=\" + hostname + \")(protocol=tcp)(port=\" + port\n              + \"))(connect_data=(sid=\" + databaseName + \")))\";\n        } else {\n          // User wants the shortcut url\n          return \"jdbc:oracle:oci:@\" + databaseName;\n        }\n      } else {\n        throw new KettleDatabaseException(\n            \"Unable to construct a JDBC URL: at least the database name must be specified\" );\n      }\n    }\n  }\n\n  /**\n   * Oracle doesn't support options in the URL, we need to put these in a Properties object at connection time...\n   */\n  @Override\n  public boolean supportsOptionsInURL() {\n    return false;\n  }\n\n  /**\n   * @return true if the database supports sequences\n   */\n  @Override\n  public boolean supportsSequences() {","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/database/OracleDatabaseMeta.java#L130-L166","documentation":"OracleDatabaseMeta.getURL throws this KettleDatabaseException when the Oracle connection attributes are too incomplete to build any JDBC URL — specifically, no database name (SID/service) is specified. A JDBC URL cannot be formed for the requested access type (OCI/thin) without it.","triggerScenarios":"Calling getURL(hostname, port, null-or-empty databaseName, ...) on an Oracle database meta while the selected access method requires a SID/service name (e.g. OCI shortcut form 'jdbc:oracle:oci:@name').","commonSituations":"Oracle connection settings in a transformation/job leaving the SID/Service field empty; misconfigured repository connection; users assuming the TNS alias is optional for the chosen access type.","solutions":["Set the database name (SID or service name) in the Oracle connection dialog/database meta before connecting","If using a TNS alias via OCI, provide the alias as the database name","Switch access method (e.g. to a manual JDBC URL or TNS-based option) that does not require the SID field"],"exampleFix":"// before\nDatabaseMeta db = new DatabaseMeta(\"oracle\", \"Oracle\", \"Native\", \"host\", \"\", \"1521\", \"user\", \"pass\");\n// after\nDatabaseMeta db = new DatabaseMeta(\"oracle\", \"Oracle\", \"Native\", \"host\", \"ORCL\", \"1521\", \"user\", \"pass\");","handlingStrategy":"validation","validationCode":"if (databaseMeta.getDatabaseName() == null || databaseMeta.getDatabaseName().trim().isEmpty()) {\n  throw new IllegalArgumentException(\"Oracle connection requires a database name (SID or service name)\");\n}","typeGuard":"function hasOracleDatabaseName(DatabaseMeta db) { return db != null && db.getDatabaseName() != null && !db.getDatabaseName().trim().isEmpty(); }","tryCatchPattern":"try {\n  String url = oracleMeta.getURL(hostname, port, databaseName);\n} catch (KettleDatabaseException e) {\n  log.error(\"Oracle JDBC URL could not be built — database name missing\", e);\n}","preventionTips":["Always fill in the SID/Service (database name) field for Oracle connections","Validate connection attributes before saving the database meta to the repository","Match the access method (OCI vs manual URL) to the provided attributes"],"tags":["oracle","jdbc","url","configuration"],"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"}