No Suitable Driver Found For Jdbc.sqlite
Solution 1:
What is probably happening here is that your driver is not in your classpath. Your current problem is that you are dynamically loading the driver but it is not found.
You can turn this into a compile time error while debugging by adding to the import directives:
import org.sqlite.JDBC;
The difference is that the import directive is a compile-time dependency while the Class.forName call establishes a run-time dependency. Usually we do this so we can change which databases are used without recompiling (but here you have your connection string hardwired so there is no point to doing it dynamically). For example we could allow the connection string to be configured, and then load the appropriate driver dynamically.
So for now, add that import line and troubleshoot why the class is not found. Chances are you have a build or class path problem. If you are using maven, for example, you would want to add it there.
Once it compiles, you can remove the import directive and turn the error back into a run-time error.
But the basic checklist is:
- Is the library available?
- Is it in a path that is searched?
- Do you have automatic dependency management tools (like maven) that are missing it as a dependency?
Post a Comment for "No Suitable Driver Found For Jdbc.sqlite"