Reputation:
I'm trying to connect to database with SQLite. There is no error appears in editor, but when I run the application I am getting error message that says;
"java.sql.SQLException: No suitable driver found for jdbc:sqlite//school.sqlite"
package dbUtil;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class dbConnection {
private static final String SQCONN = "jdbc:sqlite//school.sqlite";
public static Connection getConnection() throws SQLException {
try {
Class.forName("org.sqlite.JDBC");
return DriverManager.getConnection(SQCONN);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
return null;
}
}
I did download the latest sqlite driver to library which is "sqlite-jdbc-3.23.1"
Can anybody help me for this error message? Thankyou,
Upvotes: 0
Views: 176
Reputation:
If anybody sees this post and having the same problem, I just changed
private static final String SQCONN = "jdbc:sqlite//school.sqlite";
to fullpath;
private static final String SQCONN = "jdbc:sqlite:/C:/Users/MAMI/Desktop/OKUL/SchoolSystem/src/school.sqlite";
as @a_horse_with_no_name mentioned. Works fine now.
Thanks again
Upvotes: 1