{"record":{"id":"3b198f31cf7762bc","repo":"quarkusio/quarkus","slug":"datasource-datasourcename-does-not-have-a-jdbc-u","errorCode":null,"errorMessage":"Datasource <dataSourceName> does not have a JDBC URL and should not be created","messagePattern":"Datasource <dataSourceName> does not have a JDBC URL and should not be created","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java","lineNumber":156,"sourceCode":"    public AgroalDataSource getDataSource(String dataSourceName) {\n        return ClientProxy.unwrap(AgroalDataSourceUtil.dataSourceInstance(dataSourceName).get());\n    }\n\n    @SuppressWarnings(\"resource\")\n    public AgroalDataSource createDataSource(String dataSourceName, boolean otelEnabled,\n            Map<String, String> buildTimeJdbcProperties) {\n        if (!agroalDataSourceSupport.entries.containsKey(dataSourceName)) {\n            throw new IllegalArgumentException(\"No datasource named '\" + dataSourceName + \"' exists\");\n        }\n\n        DataSourceJdbcBuildTimeConfig dataSourceJdbcBuildTimeConfig = dataSourcesJdbcBuildTimeConfig\n                .dataSources().get(dataSourceName).jdbc();\n        DataSourceRuntimeConfig dataSourceRuntimeConfig = dataSourcesRuntimeConfig.dataSources().get(dataSourceName);\n\n        DataSourceJdbcRuntimeConfig dataSourceJdbcRuntimeConfig = dataSourcesJdbcRuntimeConfig\n                .dataSources().get(dataSourceName).jdbc();\n        if (!dataSourceJdbcRuntimeConfig.url().isPresent()) {\n            throw new IllegalArgumentException(\n                    \"Datasource \" + dataSourceName + \" does not have a JDBC URL and should not be created\");\n        }\n\n        // we first make sure that all available JDBC drivers are loaded in the current TCCL\n        loadDriversInTCCL();\n\n        AgroalDataSourceSupport.Entry matchingSupportEntry = agroalDataSourceSupport.entries.get(dataSourceName);\n        String resolvedDriverClass = matchingSupportEntry.resolvedDriverClass;\n        Class<?> driver;\n        try {\n            driver = Class.forName(resolvedDriverClass, true, Thread.currentThread().getContextClassLoader());\n        } catch (ClassNotFoundException e) {\n            throw new RuntimeException(\n                    \"Unable to load the datasource driver \" + resolvedDriverClass + \" for datasource \" + dataSourceName, e);\n        }\n\n        String jdbcUrl = dataSourceJdbcRuntimeConfig.url().get();\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSources.java#L138-L174","documentation":"Agroal (Quarkus datasources) refuses to create a datasource when no JDBC URL is configured for it. The check exists because a datasource without a connection URL has nothing to connect to; typically the user enabled JDBC (e.g. set a db-kind or driver) but forgot quarkus.datasource.jdbc.url.","triggerScenarios":"Calling DataSources.createDataSource (via config apply/startup) for a named datasource whose dataSourcesJdbcRuntimeConfig.dataSources().get(name).jdbc().url() is empty.","commonSituations":"Defining a second named datasource and setting quarkus.datasource.<name>.db-kind but not quarkus.datasource.<name>.jdbc.url; relying on dev services in dev mode then running prod without a URL; typo in the property name.","solutions":["Set quarkus.datasource.<name>.jdbc.url (e.g. jdbc:postgresql://localhost:5432/mydb) in application.properties or via env var QUARKUS_DATASOURCE_<NAME>_JDBC_URL","If the datasource should not exist, remove all its jdbc.* config so it is not created at all","Verify the property key spelling matches the datasource name exactly (unnamed default datasource uses quarkus.datasource.jdbc.url)","In prod, confirm config sources (env vars, -D flags) actually supply the URL since dev services do not apply"],"exampleFix":"// before\nquarkus.datasource.orders.db-kind=postgresql\n// after\nquarkus.datasource.orders.db-kind=postgresql\nquarkus.datasource.orders.jdbc.url=jdbc:postgresql://localhost:5432/orders\nquarkus.datasource.orders.jdbc.driver=org.postgresql.Driver","handlingStrategy":"validation","validationCode":"String url = ConfigProvider.getConfig().getValue(\"quarkus.datasource.orders.jdbc.url\", String.class); // throws NoSuchElementException if absent — set it before startup","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair db-kind with jdbc.url for every named datasource","Use Quarkus config mapping checks or a startup smoke test that pings each datasource","Keep prod URLs in env vars and verify them in CI before packaging","Remember dev services supply URLs only in dev mode"],"tags":["quarkus","datasource","jdbc","config"],"backgroundTag":"missing-jdbc-url","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}