When I call The staement
c = DriverManager.getConnection("jdbc:sqlite:sample.db");
I get a exception saying
no Suitable Driver Found for jdbc:sqlite:sample.db
The project is running in eclipse on a windows platform.
This is what I did:
The code
try {
// exception goes off here
c = DriverManager.getConnection("jdbc:sqlite:sample.db");
} catch(Exception e){
ted=ted+1;
} //
You need to load the driver class before trying to acquire the connection. Can you try the following:
Class.forName("org.sqlite.JDBC");
This will throw NoClassDefFoundError
if the driver jar
is not on the classpath.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.