0

There so many aked this, nearly simular, here i Stackoverlow. i read twenty of them. But i need ask anyway.

I created a db successful so:

cd ~/ ..... /resources
sudo apt-get install sqlite3 libsqlite3-dev
sqlite3 mydatabase.db

enter image description here

In Java (inteliJ) i get Error:

java.sql.SQLException: No suitable driver found for jdbc:sqlite:resources:mydatabase.db

    String url = "jdbc:sqlite:resources:mydatabase.db";
    Connection conn = null;
    try {
        conn = DriverManager.getConnection(url);
    } catch (SQLException e) {
        System.out.println(e.getMessage());
    }
    return conn;

mydatabase.db

SL5net
  • 2,282
  • 4
  • 28
  • 44

3 Answers3

2

Please add the following entry to dependencies of pom.xml of your project

<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
    <groupId>org.xerial</groupId>
    <artifactId>sqlite-jdbc</artifactId>
    <version>3.34.0</version>
</dependency>

Check here for more specific version

silentsudo
  • 6,730
  • 6
  • 39
  • 81
1

Please make sure that you have downloaded the sqlite-jdbc jar file and added it as a library for this module. Here is a link to the driver on GitHub with step-by-step instructions to implement it into your module.

-1

Very thanks to silentsudo answer. I tried edit his answer, add a little, and ask him, but he was not available anymore for me like so.

Now his very good answer with little needet modification:

Please add the following entry to `dependencies` of pom.xml of your project
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
    <groupId>org.xerial</groupId>
    <artifactId>sqlite-jdbc</artifactId>
    <version>3.34.0</version>
</dependency>

probalby the its red in inetliJ.

press then: File > invalid cache > and restart intellij

then pom should not look red. and and it should work

Check here for more specific version

in inteliJ you need also to in last step invalid cache and restart intellij
SL5net
  • 2,282
  • 4
  • 28
  • 44