Im using the same driver I use in the example I found.
#Java no suitable driver found sqlite how to
Make sure that you download sqlite-jdbc-version.jar file and not other files. ': No suitable driver found for jdbc:sqlite:CLoginJava2myDB.sqlite' (I found an example about how to connect to an SQLite database in Java, the example I found works well) This program Im doing it in window builder (eclipse). You will not have to add specific classpath or implicit usage as proposed in the others answers.īelow is the link of central repository from where you can download latest driver files. If you use Maven and want to build an executable jar, you could decide to import the content of the sqlite jar into your own produced jar: If you are using Linux, just change the seperator character:ĭriverManager.getConnection("jdbc:sqlite:/your/somepath/my-db.sqlite"). You should use: DriverManager.getConnection("jdbc:sqlite:D:\\db\\my-db.sqlite").
Instead of: DriverManager.getConnection("D:\\db\\my-db.sqlite"). Added Class.forName("") statement.Īnd the error message "No suit driver" still appear, its may caused by your database path. Added the sqlite jar library to lib folder under your project, reference to it in the project build path. There is something more than just Class.forName. I think Class.forName() can be used for diagnose if the class you need is in the classpath. Durch die Nutzung unserer Seite erklärst du dich damit einverstanden, dass wir Cookies setzen. It still works! I cleaned the project and rebuild it, no more Class.forName() is needed!!! I still Don't know why. I guess that for some reason, the Class was not loaded, I don't know why.Īnd ,I delete the line above. I Checked the classpath and I was sure sqlite-jdbc-3.15.1.jar was there. No suitable driver found for jdbc:sqlite:xx.db If you are sure the jar is there, try adding this line of code before you create a connection: Class.forName("") You need something like sqlite-jdbc-3.7.2.jar or your applicable version.
Your classpath is missing the jar(s) that contain the sqlite classes and driver.