SQL Exception: No suitable driver found for jdbc:sqlite:c:\my\db\path

Hello there, so i recently wanted to create a forge mod using forge/gradle but unfortunatly i encountred an error while trying to read a sqlite3 db so i saw multiple question like this but either the solution wasn’t clear or the weren’t using sqlite i tried multiple methods like Class.forName("org.sqlite.JDBC") or driver thing new org.sqlite.JDBC()
so there is my build.gradle:

plugins {
    id 'eclipse'
    id 'idea'
    id 'maven-publish'
    id 'net.minecraftforge.gradle' version '[6.0.24,6.2)'
}

version = mod_version
group = mod_group_id

base {
    archivesName = mod_id
}

java.toolchain.languageVersion = JavaLanguageVersion.of(21)

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {



    runs {
        // applies to all the run configs below
        configureEach {
            workingDirectory project.file('run')

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'
        }

        client {
            // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
            property 'forge.enabledGameTestNamespaces', mod_id
        }

        server {
            property 'forge.enabledGameTestNamespaces', mod_id
            args '--nogui'
        }

        // The gametest system is also enabled by default for other run configs under the /test command.
        gameTestServer {
            property 'forge.enabledGameTestNamespaces', mod_id
        }

        data {
            // example of overriding the workingDirectory set in configureEach above
            workingDirectory project.file('run-data')

            // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
            args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
        }
    }
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
    mavenCentral()
    maven { url 'https://repo1.maven.org/maven2' }
    maven { url 'https://jitpack.io' }
	maven { url = "https://api.modrinth.com/maven" }
}

dependencies {
    minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
    runtimeOnly "org.xerial:sqlite-jdbc:3.50.1.0"
    implementation 'net.java.dev.jna:jna:5.13.0'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.15.2'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.15.2'
}

tasks.named('processResources', ProcessResources).configure {
    var replaceProperties = [
            minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
            forge_version: forge_version, forge_version_range: forge_version_range,
            loader_version_range: loader_version_range,
            mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
            mod_authors: mod_authors, mod_description: mod_description,
    ]
    inputs.properties replaceProperties

    filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
        expand replaceProperties + [project: project]
    }
}

// Example for how to get properties into the manifest for reading at runtime.
tasks.named('jar', Jar).configure {
    manifest {
        attributes([
            'Specification-Title'     : mod_id,
            'Specification-Vendor'    : mod_authors,
            'Specification-Version'   : '1', // We are version 1 of ourselves
            'Implementation-Title'    : project.name,
            'Implementation-Version'  : project.jar.archiveVersion,
            'Implementation-Vendor'   : mod_authors
        ])
    }
}
publishing {
    publications {
        register('mavenJava', MavenPublication) {
            artifact jar
        }
    }
    repositories {
        maven {
            url "file://${project.projectDir}/mcmodsrepo"
        }
    }
}

tasks.withType(JavaCompile).configureEach {
    options.encoding = 'UTF-8' 
}

idea.module { downloadJavadoc = downloadSources = true }

eclipse {
    synchronizationTasks 'genEclipseRuns'
}

sourceSets.each {
    def dir = layout.buildDirectory.dir("sourcesSets/$it.name")
    it.output.resourcesDir = dir
    it.java.destinationDirectory = dir
}

the library got recongized by intellij idea and with gradlew dependencies
image

How is your question Gradle related?
You said the driver is included in the IDE and dependencies output.

I assume it is also available in the build result?

So unless you do something like building a bad-practice fat jar and omitting important files like service files in META-INF, I don’t see the Gradle relation.

yes sql xerial is really added but the problem is that the class isn’t availaible at runtime I tried doing runtimeOnly but i still got the same issue and yes this is not 100% gradle but gradle have something to do with it

If the library is added and not mangled with (like service definition file omitted when building a bad-practice far jar), how do you think Gradle is involved?

Also, if you can do Class.forName("org.sqlite.JDBC") and new org.sqlite.JDBC() without getting a ClassNotFoundException as you said, it also shows that the class is available at runtime.

Besides that neither of those two lines should be necessary or useful nowadays, it is looong time ago that you needed them.