Using Sqlite JDBC Driver in a Gradle Java Project
Asked Answered
M

2

12

In this tutorial, http://www.sqlitetutorial.net/sqlite-java/sqlite-jdbc-driver/, about using sqlite with java, it starts by downloading the JDBC driver from the following website, https://bitbucket.org/xerial/sqlite-jdbc/downloads/. After that it then adds the driver to the project using a Maven build system.

I have had a look around and I cannot see what you should if you are using Gradle? What steps should you take before you the code?

I am using the Intellij IDE if this makes any difference.

Mozzarella answered 16/5, 2018 at 17:54 Comment(0)
T
21

Sqlite JDBC driver is available in Maven Central Repository: SQLite JDBC

So in Gradle you can add this dependency in your build.gradle as follows:

repositories {
    mavenCentral()
}

dependencies {
    compile group:'org.xerial', name:'sqlite-jdbc', version:'3.8.11.2'
}

Or in a Maven project in your pom.xml file:

<dependencies>
    <dependency>
        <groupId>org.xerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>3.8.11.2</version>
    </dependency>
</dependencies>
Tunnel answered 16/5, 2018 at 18:12 Comment(0)
S
15

The Gradle syntax has changed as of version 3.4. So according to new syntax add the following to your build.gradle file:

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.xerial:sqlite-jdbc:3.30.1'
}
Seagraves answered 30/5, 2020 at 14:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.