{"record":{"id":"696ce051eaa78183","repo":"cube-js/cube","slug":"drivername-is-required-property","errorCode":null,"errorMessage":"drivername is required property","messagePattern":"drivername is required property","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-jdbc-driver/src/JDBCDriver.ts","lineNumber":133,"sourceCode":"\n    const dbTypeDescription = JDBCDriver.dbTypeDescription(\n      <string>(config.dbType || getEnv('dbType', { dataSource, preAggregations })),\n    );\n\n    this.config = {\n      dbType: getEnv('dbType', { dataSource, preAggregations }),\n      url:\n        getEnv('jdbcUrl', { dataSource, preAggregations }) ||\n        dbTypeDescription && dbTypeDescription.jdbcUrl(),\n      drivername:\n        getEnv('jdbcDriver', { dataSource, preAggregations }) ||\n        dbTypeDescription && dbTypeDescription.driverClass,\n      properties: dbTypeDescription && dbTypeDescription.properties,\n      ...dbOptions\n    } as JDBCDriverConfiguration;\n\n    if (!this.config.drivername) {\n      throw new Error('drivername is required property');\n    }\n\n    if (!this.config.url) {\n      throw new Error('url is required property');\n    }\n\n    const poolName = createPoolName('jdbc', dataSource, preAggregations);\n    this.pool = new Pool(poolName, {\n      create: async () => {\n        await initMvn(await this.getCustomClassPath());\n\n        if (!this.jdbcProps) {\n          /** @protected */\n          this.jdbcProps = this.getJdbcProperties();\n        }\n\n        const getConnection = promisify(DriverManager.getConnection.bind(DriverManager));\n        return new Connection(await getConnection(this.config.url, this.jdbcProps));","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-jdbc-driver/src/JDBCDriver.ts#L115-L151","documentation":"JDBCDriver's constructor validates that a resolved JDBC driver class name (drivername) is present before creating the connection pool. It is resolved from config.drivername, the CUBEJS_DB_DRIVER_JDBC env var, or the built-in description of dbType; if all are absent, the constructor throws immediately.","triggerScenarios":"Instantiating new JDBCDriver({...}) without `drivername` and without a `dbType` (or an unknown dbType) whose mapping supplies driverClass, and without CUBEJS_DB_JDBC_DRIVER env set.","commonSituations":"Using the generic JDBC driver with only a url but no driver class; typo'd dbType not in dbTypeDescription map; env var CUBEJS_DB_JDBC_DRIVER missing in the deployment; passing driverClass instead of drivername in config.","solutions":["Pass `drivername` explicitly, e.g. drivername: 'com.mysql.cj.jdbc.Driver'","Or pass a recognized `dbType` so the built-in mapping supplies the driver class","Or set the CUBEJS_DB_JDBC_DRIVER environment variable in the deployment","Double-check the config key is `drivername` (not `driverClass`) and the class name spelling"],"exampleFix":"// before\nnew JDBCDriver({ url: 'jdbc:mysql://host:3306/db' });\n// after\nnew JDBCDriver({ url: 'jdbc:mysql://host:3306/db', drivername: 'com.mysql.cj.jdbc.Driver' });","handlingStrategy":"validation","validationCode":"function assertJdbcConfig(cfg) {\n  if (!cfg.drivername && !cfg.dbType && !process.env.CUBEJS_DB_JDBC_DRIVER) {\n    throw new Error('JDBCDriver requires `drivername` (or a known `dbType`, or CUBEJS_DB_JDBC_DRIVER env)');\n  }\n  return cfg;\n}\nconst driver = new JDBCDriver(assertJdbcConfig(options));","typeGuard":"function hasJdbcDrivername(cfg) {\n  return typeof cfg === 'object' && cfg !== null &&\n    typeof cfg.drivername === 'string' && cfg.drivername.length > 0;\n}","tryCatchPattern":"try {\n  driver = new JDBCDriver(options);\n} catch (e) {\n  if (e.message === 'drivername is required property') {\n    throw new Error(`JDBC config for dataSource is missing 'drivername': ${JSON.stringify({ ...options, url: '***' })}`);\n  }\n  throw e;\n}","preventionTips":["Always set drivername explicitly in the JDBC driver config","If relying on dbType, use a documented/known value so the class mapping resolves","Set CUBEJS_DB_JDBC_DRIVER in deployment env for env-driven setups","Remember the key is `drivername`, not `driverClass`"],"tags":["configuration","jdbc","validation"],"backgroundTag":"missing-required-config-property","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}