javasqlitemavenjdbcdriver

"No suitable driver found for jdbc:sqlite" problem. What am I doing wrong?


I changed my computer so I restarted entire process of connecting JDBC with DB using Driver. To shorten the story, I will post screenshots. Hope someone can help, as I have no idea what the problem is..

Step 1: I downloaded driver and stored it here: enter image description here

Step 2: I went to InteliJ in File/ProjectStructure/Libraries and added exact same .jar file. enter image description here

Step 3: After that I went to make a Connection with my db. It is located here: enter image description here

Step 4: Lastly I coded following statement:

try {
    Connection connection = DriverManager.getConnection("jdbc:sqlite:C:\\Users\\Stefan\\people.db");
} catch (SQLException throwables) {
    throwables.printStackTrace();
}

What I get is no suitable driver found message. I double checked everything and still have no clue what the problem is.


Solution

  • Add the dependency if you're using maven / gradle.

    Example for maven:

    <dependency>
        <groupId>org.xerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>3.32.3.2</version>
    </dependency>
    

    and for gradle:

    compile group: 'org.xerial', name: 'sqlite-jdbc', version: '3.32.3.2'