{"record":{"id":"ce70502d763b4523","repo":"cube-js/cube","slug":"unable-to-detect-sql-escaping-rules-for-db-type","errorCode":null,"errorMessage":"Unable to detect SQL escaping rules for db type \"${this.config.dbType}\"","messagePattern":"Unable to detect SQL escaping rules for db type \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-jdbc-driver/src/JDBCDriver.ts","lineNumber":244,"sourceCode":"    } else {\n      await this.pool._factory.destroy(connection);\n    }\n  }\n\n  protected prepareConnectionQueries() {\n    const dbTypeDescription = JDBCDriver.dbTypeDescription(this.config.dbType);\n    return this.config.prepareConnectionQueries ||\n      dbTypeDescription && dbTypeDescription.prepareConnectionQueries ||\n      [];\n  }\n\n  protected escapeDialect(): EscapeDialect {\n    const dbTypeDescription = JDBCDriver.dbTypeDescription(this.config.dbType);\n    if (dbTypeDescription?.escapeDialect) {\n      return dbTypeDescription.escapeDialect;\n    }\n\n    throw new Error(\n      `Unable to detect SQL escaping rules for db type \"${this.config.dbType}\"`\n    );\n  }\n\n  protected prepareQueryWithParams(query: string, values: unknown[]): string {\n    return format(this.escapeDialect(), query, values || []);\n  }\n\n  public async query<R = unknown>(query: string, values: unknown[]): Promise<R[]> {\n    const queryWithParams = this.prepareQueryWithParams(query, values);\n    const cancelObj: {cancel?: Function} = {};\n    const promise = this.queryPromised(queryWithParams, cancelObj, this.prepareConnectionQueries());\n    (promise as CancelablePromise<any>).cancel =\n      () => cancelObj.cancel && cancelObj.cancel() ||\n      Promise.reject(new Error('Statement is not ready'));\n    return promise;\n  }\n","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-jdbc-driver/src/JDBCDriver.ts#L226-L262","documentation":"escapeDialect() resolves the SQL string-escaping rules from a per-db-type description table (JDBCDriver.dbTypeDescription). It throws when the configured dbType has no registered description containing an escapeDialect — i.e. the JDBC driver was configured for a database flavor it does not know how to escape literals for, or custom prepareConnectionQueries were given without a matching dialect. The input at fault is an unsupported/unmapped this.config.dbType string.","triggerScenarios":"Thrown at packages/cubejs-jdbc-driver/src/JDBCDriver.ts:244 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the missing dbType to the JDBCDriver.dbTypeDescription registry (or a custom driver override) so it defines an escapeDialect","Override escapeDialect() in a subclass to return the correct dialect for the configured database","Verify this.config.dbType is spelled exactly as registered before instantiating the driver"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}